MNAIO: Ensure a consistent and readable style
This patch implements the following style changes: 1. The 'environment' argument is placed in the same location for all plays, making sure it's easier to find. 2. The play tags are located in the same place, also making sure they're easier to find. 3. The line breaks between tasks and plays are set to be consistently 1 between tasks and 2 between plays. 4. Given that there are no roles being used, the use of pre/post tasks is converted to only using tasks. Change-Id: I2e22c8360d65256b8e44ca1e310e0668a651196d
This commit is contained in:
parent
450a879403
commit
bc2ced27c2
multi-node-aio/playbooks
@ -15,7 +15,10 @@
|
||||
|
||||
- name: Gather facts
|
||||
hosts: pxe_hosts
|
||||
pre_tasks:
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-acng
|
||||
tasks:
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -27,7 +30,6 @@
|
||||
tags:
|
||||
- always
|
||||
|
||||
tasks:
|
||||
- name: Install repo caching server packages
|
||||
package:
|
||||
name: "{{ mnaio_pkg_cache_server_distro_packages }}"
|
||||
@ -87,7 +89,6 @@
|
||||
notify:
|
||||
- reload acng
|
||||
|
||||
post_tasks:
|
||||
- name: Drop apt package manager proxy
|
||||
copy:
|
||||
content: 'Acquire::http { Proxy "{{ default_ubuntu_mirror_proxy }}"; };'
|
||||
@ -97,14 +98,9 @@
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
handlers:
|
||||
- name: reload acng
|
||||
service:
|
||||
name: "apt-cacher-ng"
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
||||
tags:
|
||||
- deploy-acng
|
||||
|
@ -14,7 +14,10 @@
|
||||
- name: Gather facts
|
||||
hosts: dhcp_hosts
|
||||
gather_facts: "{{ gather_facts | default(true) }}"
|
||||
pre_tasks:
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-dhcpd
|
||||
tasks:
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -43,7 +46,6 @@
|
||||
enabled: yes
|
||||
with_items: "{{ mnaio_dhcp_distro_packages }}"
|
||||
|
||||
tasks:
|
||||
- name: Create a template in /etc/dhcp/dhcpd.conf
|
||||
template:
|
||||
src: dhcp/dhcpd.conf.j2
|
||||
@ -62,14 +64,9 @@
|
||||
group: root
|
||||
notify: restart dhcpd
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
handlers:
|
||||
- name: restart dhcpd
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: restarted
|
||||
with_items: "{{ mnaio_dhcp_distro_packages }}"
|
||||
|
||||
tags:
|
||||
- deploy-dhcpd
|
||||
|
@ -16,7 +16,10 @@
|
||||
- name: Setup deploy host
|
||||
hosts: deploy_hosts
|
||||
gather_facts: "{{ gather_facts | default(true) }}"
|
||||
pre_tasks:
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-osa
|
||||
tasks:
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -28,7 +31,6 @@
|
||||
tags:
|
||||
- always
|
||||
|
||||
tasks:
|
||||
# Example read-write git checkout from github
|
||||
- name: Get OSA
|
||||
git:
|
||||
@ -154,8 +156,3 @@
|
||||
to the {{ groups['deploy_hosts'][0] }} VM and attach to the "build-osa" tmux session.
|
||||
when:
|
||||
- run_osa | default(true) | bool
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-osa
|
||||
|
@ -16,7 +16,10 @@
|
||||
- name: Gather facts
|
||||
hosts: pxe_hosts
|
||||
gather_facts: "{{ gather_facts | default(true) }}"
|
||||
pre_tasks:
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-pxe
|
||||
tasks:
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -69,7 +72,6 @@
|
||||
when:
|
||||
- tftp_ssh_key is undefined
|
||||
|
||||
tasks:
|
||||
- name: Drop NGINX config
|
||||
copy:
|
||||
src: "pxe/sites-enabled.default"
|
||||
@ -211,8 +213,6 @@
|
||||
- "/var/lib/tftpboot"
|
||||
- "/var/www/pxe"
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
handlers:
|
||||
- name: restart nginx
|
||||
service:
|
||||
@ -231,6 +231,3 @@
|
||||
name: "inetutils-inetd"
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
||||
tags:
|
||||
- deploy-pxe
|
||||
|
@ -16,7 +16,10 @@
|
||||
- name: Gather facts
|
||||
hosts: vm_hosts
|
||||
gather_facts: "{{ gather_facts | default(true) }}"
|
||||
pre_tasks:
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-vms
|
||||
tasks:
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -28,7 +31,6 @@
|
||||
tags:
|
||||
- always
|
||||
|
||||
tasks:
|
||||
- name: Stop running VMs
|
||||
command: "virsh destroy {{ hostvars[item]['server_hostname'] }}"
|
||||
failed_when: false
|
||||
@ -123,15 +125,13 @@
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-vms
|
||||
|
||||
|
||||
- name: Create vm_servers group
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-vms
|
||||
tasks:
|
||||
- name: VM Servers group
|
||||
add_host:
|
||||
@ -141,17 +141,12 @@
|
||||
- hostvars[item]['server_vm'] | default(false) | bool
|
||||
with_items: "{{ groups['pxe_servers'] }}"
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-vms
|
||||
|
||||
|
||||
- name: Wait for deploy host
|
||||
hosts: vm_servers
|
||||
gather_facts: false
|
||||
any_errors_fatal: true
|
||||
pre_tasks:
|
||||
tasks:
|
||||
- name: Wait for connectivity 1
|
||||
local_action:
|
||||
module: wait_for
|
||||
@ -162,7 +157,7 @@
|
||||
timeout: 1500
|
||||
state: started
|
||||
search_regex: OpenSSH
|
||||
tasks:
|
||||
|
||||
- name: copy host keys
|
||||
copy:
|
||||
src: "{{ item.src }}"
|
||||
@ -174,12 +169,16 @@
|
||||
- src: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa.pub"
|
||||
dest: /root/.ssh/id_rsa.pub
|
||||
|
||||
|
||||
# In vm-post-install-script.sh.j2 we chattr +i the interfaces file to prevent
|
||||
# the preseed system from overwriting the file after we've modified it. The
|
||||
# task below simply removes the immutable attribute.
|
||||
- name: Remove immutable attr from /etc/network/interfaces
|
||||
hosts: vm_servers
|
||||
gather_facts: true
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-vms
|
||||
tasks:
|
||||
- file:
|
||||
path: /etc/network/interfaces
|
||||
@ -188,16 +187,14 @@
|
||||
- ansible_distribution | lower == "ubuntu"
|
||||
- ansible_distribution_release | lower == "trusty"
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-vms
|
||||
|
||||
|
||||
- name: Set MaxSessions and MaxStartups to reduce connection failures
|
||||
hosts: vm_servers
|
||||
gather_facts: "{{ gather_facts | default(true) }}"
|
||||
pre_tasks:
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-vms
|
||||
tasks:
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -208,7 +205,7 @@
|
||||
- "{{ playbook_dir }}/vars/{{ ansible_os_family | lower }}.yml"
|
||||
tags:
|
||||
- always
|
||||
tasks:
|
||||
|
||||
- lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: MaxStartups 100
|
||||
@ -216,6 +213,7 @@
|
||||
regexp: '^MaxStartups.*$'
|
||||
notify:
|
||||
- restart sshd
|
||||
|
||||
- lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
line: MaxSessions 100
|
||||
@ -223,21 +221,20 @@
|
||||
regexp: '^MaxSessions.*$'
|
||||
notify:
|
||||
- restart sshd
|
||||
|
||||
handlers:
|
||||
- name: restart sshd
|
||||
service:
|
||||
name: "{{ ssh_service_name }}"
|
||||
state: restarted
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-vms
|
||||
|
||||
|
||||
- name: Setup cinder host volume
|
||||
hosts: cinder_hosts:swift_hosts
|
||||
gather_facts: false
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-vms
|
||||
tasks:
|
||||
- name: un-mount deleteme mount
|
||||
mount:
|
||||
@ -256,15 +253,13 @@
|
||||
force: true
|
||||
state: absent
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-vms
|
||||
|
||||
|
||||
- name: Setup cinder host volume
|
||||
hosts: cinder_hosts
|
||||
gather_facts: false
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-vms
|
||||
tasks:
|
||||
- name: Create cinder-volumes lv
|
||||
lvol:
|
||||
@ -278,15 +273,13 @@
|
||||
vg: cinder-volumes
|
||||
pvs: "/dev/vmvg00/cinder-volumes00"
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-vms
|
||||
|
||||
|
||||
- name: Setup swift host volume
|
||||
hosts: swift_hosts
|
||||
gather_facts: false
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- deploy-vms
|
||||
tasks:
|
||||
- name: Remove deleteme lv
|
||||
lvol:
|
||||
@ -329,8 +322,3 @@
|
||||
- disk1
|
||||
- disk2
|
||||
- disk3
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- deploy-vms
|
||||
|
@ -16,7 +16,10 @@
|
||||
- name: Gather facts
|
||||
hosts: mnaio_hosts
|
||||
gather_facts: "{{ gather_facts | default(true) }}"
|
||||
pre_tasks:
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
tags:
|
||||
- setup-host
|
||||
tasks:
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -78,7 +81,6 @@
|
||||
retries: 3
|
||||
delay: 15
|
||||
|
||||
tasks:
|
||||
- name: Ensure root has a .ssh directory
|
||||
file:
|
||||
path: /root/.ssh
|
||||
@ -281,8 +283,3 @@
|
||||
echo ${module} | tee -a /etc/modules
|
||||
fi
|
||||
done
|
||||
|
||||
environment: "{{ deployment_environment_variables | default({}) }}"
|
||||
|
||||
tags:
|
||||
- setup-host
|
||||
|
Loading…
x
Reference in New Issue
Block a user