2021-12-30 02:25:12 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Bootstrap
|
2022-01-10 18:20:05 +00:00
|
|
|
hosts: "{{ host }}"
|
2021-12-30 02:25:12 +00:00
|
|
|
become: true
|
|
|
|
|
|
|
|
handlers:
|
|
|
|
- import_tasks: handlers/main.yml
|
|
|
|
|
|
|
|
pre_tasks:
|
|
|
|
- name: Check if ansible cannot be run here
|
|
|
|
stat:
|
|
|
|
path: /etc/no-ansible
|
|
|
|
register: no_ansible
|
|
|
|
|
|
|
|
- name: Verify if we can run ansible
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "not no_ansible.stat.exists"
|
|
|
|
success_msg: "We are able to run on this node"
|
|
|
|
fail_msg: "/etc/no-ansible exists - skipping run on this node"
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Loading Variables from OS Common
|
|
|
|
import_tasks: tasks/common_vars.yml
|
|
|
|
|
|
|
|
- name: Bootstrap ansible
|
|
|
|
become: true
|
|
|
|
shell: scripts/bootstrap-ansible.sh
|
|
|
|
args:
|
|
|
|
chdir: /opt/openstack-ansible/
|
|
|
|
creates: /etc/ansible/
|
|
|
|
tags:
|
|
|
|
- bootstrap
|
|
|
|
|
2022-02-04 01:11:23 +00:00
|
|
|
#- name: Fix roles
|
|
|
|
# become: true
|
|
|
|
# ansible.builtin.shell:
|
|
|
|
# cmd: "{{ item }}"
|
|
|
|
# with_items:
|
|
|
|
# - grep -ril 'openstack.config_template.' /etc/ansible/roles/ | xargs sed -i.bak 's,openstack.config_template.,,g'
|
|
|
|
# - grep -ril 'openstack.osa.provider_networks' /etc/ansible/roles/ | xargs sed -i.bak 's,openstack.osa.provider_networks,provider_networks,g'
|
|
|
|
# - grep -ril 'openstack.osa.db_se' /etc/ansible/roles/ | xargs sed -i.bak 's,openstack.osa.provider_networks,provider_networks,g'
|
|
|
|
# tags:
|
|
|
|
# - temporary
|
|
|
|
# - ansible
|
|
|
|
# - bootstrap
|
2021-12-30 02:25:12 +00:00
|
|
|
|
|
|
|
- name: Deploy and setup configuration
|
2022-01-10 18:20:05 +00:00
|
|
|
when: not aio_install | default('true') # bootstrap-AIO script instead does these things.
|
2021-12-30 02:25:12 +00:00
|
|
|
block:
|
|
|
|
- name: Copy template to etc
|
|
|
|
ansible.builtin.copy:
|
|
|
|
remote_src: yes
|
2022-01-05 21:57:06 +00:00
|
|
|
src: /opt/openstack-ansible/etc/openstack_deploy/
|
|
|
|
dest: /etc/openstack_deploy/
|
2021-12-30 02:25:12 +00:00
|
|
|
directory_mode: yes
|
2022-01-10 18:20:05 +00:00
|
|
|
force: no
|
2021-12-30 02:25:12 +00:00
|
|
|
|
2022-01-10 18:20:05 +00:00
|
|
|
- name: Copy distributed openstack configs
|
2021-12-30 02:25:12 +00:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "files/{{ item }}.yml"
|
|
|
|
dest: /etc/openstack_deploy/
|
|
|
|
mode: '0644'
|
|
|
|
with_items:
|
|
|
|
- openstack_user_config
|
|
|
|
|
|
|
|
- name: Create secrets
|
|
|
|
become: true
|
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: /opt/openstack-ansible/scripts/pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml
|
|
|
|
tags: secrets
|
|
|
|
args:
|
|
|
|
creates: /etc/openstack_deploy/user_secrets.yml.tar
|
|
|
|
|
2022-02-07 04:00:18 +00:00
|
|
|
- import_tasks: tasks/python3-lxc.yml
|
|
|
|
|
2022-01-10 18:20:05 +00:00
|
|
|
- name: "[AIO] Deploy and setup configuration / bootstrap"
|
|
|
|
when: aio_install | default('false')
|
|
|
|
block:
|
|
|
|
- name: Debug - Running AIO bootstrap
|
|
|
|
debug:
|
|
|
|
var: aio_install
|
|
|
|
|
2022-02-07 15:32:36 +00:00
|
|
|
- name: Run bootstrap aio with included args
|
2022-01-10 18:20:05 +00:00
|
|
|
ansible.builtin.shell: scripts/bootstrap-aio.sh
|
|
|
|
become: true
|
|
|
|
args:
|
|
|
|
chdir: /opt/openstack-ansible/
|
|
|
|
creates: /etc/openstack_deploy/
|
2022-02-07 15:32:36 +00:00
|
|
|
environment:
|
|
|
|
SCENARIO: "{{ SCENARIO | default('') }}"
|
2022-01-10 18:20:05 +00:00
|
|
|
tags:
|
|
|
|
- bootstrap
|
|
|
|
- aio
|
|
|
|
|
2022-02-04 01:11:23 +00:00
|
|
|
#- name: Create volume group for cinder
|
|
|
|
# lvg:
|
|
|
|
# pv_options: --metadatasize=2048
|
|
|
|
# pvs: "{{ cinder_pv_device | default('/dev/vdb') }}"
|
|
|
|
# vg: cinder-volumes
|
2022-01-10 18:20:05 +00:00
|
|
|
|
|
|
|
- name: Copy common openstack configs
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "files/{{ item }}.yml"
|
|
|
|
dest: /etc/openstack_deploy/
|
|
|
|
mode: '0644'
|
|
|
|
with_items:
|
|
|
|
- user_lxc
|
2022-01-22 23:44:47 +00:00
|
|
|
- user_galera
|
2022-02-07 04:00:18 +00:00
|
|
|
- user_debug
|
2022-02-04 01:11:23 +00:00
|
|
|
tags: config
|
2022-01-15 20:56:13 +00:00
|
|
|
|
2022-02-07 15:32:36 +00:00
|
|
|
- name: manually patch lxc_hosts role to bring in powertools repo
|
2022-02-04 02:34:52 +00:00
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "files/{{ item }}.yml"
|
|
|
|
dest: /etc/ansible/roles/lxc_hosts/tasks/
|
|
|
|
mode: '0644'
|
|
|
|
with_items:
|
|
|
|
- lxc_install_dnf
|
|
|
|
tags: config
|
|
|
|
|
2022-02-07 15:32:36 +00:00
|
|
|
- name: manually patch os_nova role to kill powervmtools and futures== requiresments
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "files/{{ item }}"
|
|
|
|
dest: /tmp/
|
|
|
|
mode: '0644'
|
|
|
|
with_items:
|
|
|
|
- os_nova.patch
|
|
|
|
tags: config
|
|
|
|
|
|
|
|
- name: patch the thing
|
|
|
|
args:
|
|
|
|
chdir: /etc/ansible/roles/os_nova/
|
|
|
|
ansible.builtin.shell: patch -p1 < /tmp/os_nova.patch
|
|
|
|
when: do_patch | bool
|
|
|
|
|
2022-01-15 20:56:13 +00:00
|
|
|
- name: Disable SSH Agent Forwarding
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/ssh/sshd_config
|
|
|
|
regexp: '^.*AllowAgentForwarding'
|
|
|
|
line: 'AllowAgentForwarding no'
|
|
|
|
tags: services
|
|
|
|
notify:
|
|
|
|
- restart_sshd
|
2022-01-10 18:20:05 +00:00
|
|
|
|
2021-12-30 02:25:12 +00:00
|
|
|
|
|
|
|
- name: Check playbooks
|
|
|
|
tags: syntax
|
|
|
|
become: true
|
|
|
|
ansible.builtin.shell:
|
2022-01-05 21:57:06 +00:00
|
|
|
cmd: "openstack-ansible --syntax-check setup-{{ item }}.yml"
|
2021-12-30 02:25:12 +00:00
|
|
|
args:
|
|
|
|
chdir: /opt/openstack-ansible/playbooks/
|
2022-01-05 21:57:06 +00:00
|
|
|
loop:
|
2021-12-30 02:25:12 +00:00
|
|
|
- hosts
|
|
|
|
- infrastructure
|
|
|
|
- openstack
|
|
|
|
register: playbooks_res
|
|
|
|
|
|
|
|
post_tasks:
|
|
|
|
- name: Touching run file that ansible has ran here
|
|
|
|
file:
|
|
|
|
path: /var/log/ansible.run
|
|
|
|
state: touch
|
|
|
|
mode: '0644'
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
...
|