
add non-dockerized installation playbooks and roles Change-Id: Ica4918a3627ce20db6b4a9823bbbbbaff92b9101
275 lines
8.3 KiB
YAML
275 lines
8.3 KiB
YAML
---
|
|
|
|
- name: install base packages
|
|
yum: name={{ item }} state=present
|
|
with_items:
|
|
- wget
|
|
- git
|
|
|
|
- name: check epel presence
|
|
command: rpm -q epel-release
|
|
register: epel_presence
|
|
ignore_errors: yes
|
|
|
|
#- name: get epel version
|
|
# command: >
|
|
# wget -q {{ epel_base_url }} -O - | grep -oE "(href=\"epel-release-6-[0-9,.].*)" | cut -d\" -f2
|
|
# register: epel_file_name
|
|
# when: epel_presence.rc != 0
|
|
|
|
- name: install epel
|
|
yum: name={{ epel_base_url }}/{{ epel_file_name }} state=present
|
|
when: epel_presence.rc != 0
|
|
|
|
- name: yum update
|
|
yum: name=* state=latest update_cache=yes
|
|
|
|
- name: install related packages
|
|
yum: name={{ item }} state=present
|
|
with_items:
|
|
- cobbler
|
|
- cobbler-web
|
|
- createrepo
|
|
- mkisofs
|
|
- syslinux
|
|
- debmirror
|
|
- pykickstart
|
|
- cman
|
|
- bind
|
|
- rsync
|
|
- dhcp
|
|
- xinetd
|
|
- tftp-server
|
|
- gcc
|
|
- httpd
|
|
|
|
- name: turn off iptables
|
|
service: name=iptables state=stopped enabled=no
|
|
|
|
- name: replace config files
|
|
copy: src={{ item.name }} dest={{ item.dest }}
|
|
with_items:
|
|
- { name: rsync, dest: /etc/xinetd.d/rsync }
|
|
- { name: debmirror.conf, dest: /etc/debmirror.conf }
|
|
|
|
- name: configure interface for dhcp
|
|
command: ifconfig {{ mgmt_nic }}:1 {{ mgmt_next_ip }} netmask {{ mgmt_subnet_mask }}
|
|
|
|
- name: copy httpd configuration files
|
|
file: src={{ item }} dest=/etc/httpd/conf.d/{{ item }} mode=0644
|
|
with_items:
|
|
- cobbler_web.conf
|
|
- ssl.conf
|
|
notify:
|
|
restart httpd
|
|
|
|
- name: disable selinux
|
|
selinux: state=disabled
|
|
|
|
- name: disable selinux real time
|
|
shell: echo 0 > /selinux/enforce
|
|
|
|
- name: copy cobbler configuration files
|
|
template: src={{ item.name }} dest=/etc/cobbler/{{ item.file_name }} mode=0644
|
|
with_items:
|
|
- { name: tftpd.template, file_name: tftpd.template }
|
|
- { name: modules.conf, file_name: modules.conf }
|
|
- { name: dhcp.template.nodocker.j2, file_name: dhcp.template }
|
|
- { name: named.template.nodocker.j2, file_name: named.template }
|
|
- { name: settings.j2, file_name: settings }
|
|
notify:
|
|
- restart cobbler
|
|
- cobbler sync
|
|
|
|
- meta: flush_handlers
|
|
|
|
- name: clone snippets
|
|
git: repo={{ compass_adapter_source }}
|
|
dest=/opt/compass-adapters
|
|
version={{ compass_adapter_version }}
|
|
force=yes
|
|
|
|
- name: copy snippets to cobbler folder
|
|
command: cp -r /opt/compass-adapters/cobbler/{{ item }} /var/lib/cobbler/{{ item }}
|
|
with_items:
|
|
- snippets
|
|
- scripts
|
|
- triggers
|
|
|
|
- name: change snippets mode
|
|
file: path=/var/lib/cobbler mode=0755 recurse=yes
|
|
|
|
- name: copy default kickstart files
|
|
command: cp -r /opt/compass-adapters/cobbler/kickstarts/{{ item }} /var/lib/cobbler/kickstarts/{{ item }}
|
|
with_items:
|
|
- default.ks
|
|
- default.seed
|
|
|
|
- name: change kickstart mode
|
|
file: path=/var/lib/cobbler/kickstarts mode=0666 recurse=yes
|
|
|
|
- name: disable selinux
|
|
selinux: state=disabled
|
|
|
|
- name: disable selinux real time
|
|
command: echo 0 > /selinux/enforce
|
|
|
|
- name: create cobbler log directories
|
|
file: path={{ item }} mode=0644 state=directory recurse=yes
|
|
with_items:
|
|
# - /var/log/cobbler
|
|
- /var/log/cobbler/anamon
|
|
- /var/log/cobbler/tasks
|
|
|
|
- name: create cobbler ppa repo dir
|
|
file: path=/var/lib/cobbler/{{ item }}
|
|
state=directory
|
|
mode=0644
|
|
recurse=yes
|
|
with_items:
|
|
- repo_mirror/centos_6_5_ppa_repo
|
|
- repo_mirror/ubuntu_12_04_ppa_repo/conf
|
|
- repo_mirror/ubuntu_14_04_ppa_repo/conf
|
|
|
|
#- name: download centos ppa repo rpms
|
|
# get_url: url={{ item }}
|
|
# dest=/var/lib/cobbler/repo_mirror/centos_6_5_ppa_repo/
|
|
# with_items:
|
|
# - "{{ ntp }}"
|
|
# - "{{ ssh_client }}"
|
|
# - "{{ openssh }}"
|
|
# - "{{ iproute }}"
|
|
# - "{{ wget }}"
|
|
# - "{{ ntpdate }}"
|
|
# - "{{ yum_priorities }}"
|
|
# - "{{ jsonc }}"
|
|
# - "{{ libestr }}"
|
|
# - "{{ libgt }}"
|
|
# - "{{ liblogging }}"
|
|
# - "{{ rsyslog }}"
|
|
|
|
- name: copy distributions to ubuntu ppa repo
|
|
template: src=distributions
|
|
dest=/var/lib/cobbler/repo_mirror/ubuntu_12_04_ppa_repo/conf/distributions
|
|
mode=0644
|
|
|
|
- name: copy distribution to ubuntu 14.04 ppa repo
|
|
template: src=distributions
|
|
dest=/var/lib/cobbler/repo_mirror/ubuntu_14_04_ppa_repo/conf/distributions
|
|
mode=0644
|
|
|
|
- name: start cobbler and httpd services
|
|
service: name={{ item }} state=restarted enabled=yes
|
|
with_items:
|
|
- httpd
|
|
- cobblerd
|
|
|
|
- name: download ppa repo images
|
|
get_url: url={{ item.name }} dest=/var/lib/cobbler/repo_mirror/{{ item.filename }}.tar.gz
|
|
with_items:
|
|
- { name: "{{ centos_6_5_ppa_repo_url }}", filename: "centos_6_5_ppa_repo" }
|
|
- { name: "{{ ubuntu_12_04_ppa_repo_url }}", filename: "ubuntu_12_04_ppa_repo" }
|
|
- { name: "{{ ubuntu_14_04_ppa_repo_url }}", filename: "ubuntu_14_04_ppa_repo" }
|
|
|
|
- name: untar ppa repo images
|
|
unarchive: src=/var/lib/cobbler/repo_mirror/{{ item }}.tar.gz
|
|
dest=/var/lib/cobbler/repo_mirror/
|
|
copy=no
|
|
with_items:
|
|
- centos_6_5_ppa_repo
|
|
- ubuntu_12_04_ppa_repo
|
|
- ubuntu_14_04_ppa_repo
|
|
|
|
- name: add repos
|
|
command: cobbler repo add --name {{ item }} --mirror=/var/lib/cobbler/repo_mirror/{{ item }} --mirror-locally=Y --arch=x86_64
|
|
with_items:
|
|
- centos_6_5_ppa_repo
|
|
- ubuntu_12_04_ppa_repo
|
|
- ubuntu_14_04_ppa_repo
|
|
args:
|
|
creates: /opt/repo_added.txt
|
|
ignore_errors: yes
|
|
|
|
- name: cobbler repo sync
|
|
command: cobbler reposync
|
|
|
|
- name: cobbler get loaders
|
|
command: cobbler get-loaders
|
|
|
|
- name: create directory for images
|
|
file: path=/var/lib/cobbler/iso state=directory
|
|
|
|
- name: download images
|
|
get_url: url={{ item.name }} dest=/var/lib/cobbler/iso/{{ item.filename }} mode=0644
|
|
with_items:
|
|
- { name: "{{ centos_url }}", filename: "{{ centos }}.iso" }
|
|
- { name: "{{ ubuntu_url }}", filename: "{{ ubuntu }}.iso" }
|
|
- { name: "{{ ubuntu_1404_url }}", filename: "{{ ubuntu_1404 }}.iso" }
|
|
|
|
- name: mount_info
|
|
command: mount
|
|
register: mount_info
|
|
|
|
- name: create mount point
|
|
file: name=/mnt/{{ item }} state=directory
|
|
with_items:
|
|
- "{{ centos }}"
|
|
- "{{ ubuntu }}"
|
|
- "{{ ubuntu_1404 }}"
|
|
when: mount_info.stdout.find('CentOS') == -1
|
|
|
|
- name: mount images
|
|
shell: mount -o loop /var/lib/cobbler/iso/{{ item }}.iso /mnt/{{ item }}
|
|
with_items:
|
|
- "{{ centos }}"
|
|
- "{{ ubuntu }}"
|
|
- "{{ ubuntu_1404 }}"
|
|
when: mount_info.stdout.find('CentOS') == -1
|
|
args:
|
|
creates: /opt/image_mounted.txt
|
|
|
|
- name: import distros
|
|
command: cobbler import --path=/mnt/{{ item.name }} --name {{ item.name }} --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed={{ item.breed }}
|
|
with_items:
|
|
- { name: "{{ centos }}", breed: redhat }
|
|
- { name: "{{ ubuntu }}", breed: ubuntu }
|
|
- { name: "{{ ubuntu_1404 }}", breed: ubuntu }
|
|
args:
|
|
creates: /opt/distro_imported.txt
|
|
ignore_errors: yes
|
|
run_once: True
|
|
|
|
- name: add profiles
|
|
command: cobbler profile add --name={{ item.name }} --repo={{ item.repo }} --distro={{ item.name }} --ksmeta="tree=http://{{ mgmt_next_ip }}/cobbler/ks_mirror/{{ item.name }}" --kickstart=/var/lib/cobbler/kickstarts/{{ item.kickstart }} --kopts="{{ item.kopts }}"
|
|
with_items:
|
|
- { name: "{{ centos }}", repo: centos_6_5_ppa_repo, kickstart: default.ks, kopts: "" }
|
|
- { name: "{{ ubuntu }}", repo: ubuntu_12_04_ppa_repo, kickstart: default.seed, kopts: "netcfg/choose_interface=auto" }
|
|
- { name: "{{ ubuntu_1404 }}", repo: ubuntu_14_04_ppa_repo, kickstart: default.seed, kopts: "netcfg/choose_interface=auto"}
|
|
args:
|
|
creates: /opt/profile_added.txt
|
|
ignore_errors: yes
|
|
run_once: True
|
|
|
|
- name: edit profiles
|
|
command: cobbler profile edit --name={{ item.name }} --repo={{ item.repo }} --distro={{ item.name }} --ksmeta="tree=http://{{ mgmt_next_ip }}/cobbler/ks_mirror/{{ item.name }}" --kickstart=/var/lib/cobbler/kickstarts/{{ item.kickstart }} --kopts="{{ item.kopts }}"
|
|
with_items:
|
|
- { name: "{{ centos }}", repo: centos_6_5_ppa_repo, kickstart: default.ks, kopts: "" }
|
|
- { name: "{{ ubuntu }}", repo: ubuntu_12_04_ppa_repo, kickstart: default.seed, kopts: "netcfg/choose_interface=auto" }
|
|
- { name: "{{ ubuntu_1404 }}", repo: ubuntu_14_04_ppa_repo, kickstart: default.seed, kopts: "netcfg/choose_interface=auto"}
|
|
|
|
- name: remove ubuntu default repo
|
|
command: cobbler repo remove --name {{ item }}
|
|
with_items:
|
|
- "{{ ubuntu }}"
|
|
- "{{ ubuntu_1404 }}"
|
|
ignore_errors: yes
|
|
|
|
- name: cobbler repo sync again
|
|
command: cobbler reposync
|
|
|
|
- name: cobler sync
|
|
command: cobbler sync
|
|
|
|
- name: cobbler check
|
|
command: cobbler check
|