Skip to content

Instantly share code, notes, and snippets.

@amarao
Created January 23, 2023 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amarao/a3062f9790d7ea19633d18d3eeb83709 to your computer and use it in GitHub Desktop.
Save amarao/a3062f9790d7ea19633d18d3eeb83709 to your computer and use it in GitHub Desktop.
---
- name: Deploy artifacts
hosts: deployment,targets
gather_facts: false
vars:
venv_sections:
- horizon
- neutron
- nova
- glance
- placement
- uwsgi
- keystone
artifacts:
- host_dir: /openstack/venvs/glance-{{ openstack_ansible_version }}
tar: glance-{{ openstack_ansible_version }}.tar.gz
- host_dir: /openstack/venvs/horizon-{{ openstack_ansible_version }}
tar: horizon-{{ openstack_ansible_version }}.tar.gz
- host_dir: /openstack/venvs/keystone-{{ openstack_ansible_version }}
tar: keystone-{{ openstack_ansible_version }}.tar.gz
- host_dir: /openstack/venvs/neutron-{{ openstack_ansible_version }}
tar: neutron-{{ openstack_ansible_version }}.tar.gz
- host_dir: /openstack/venvs/nova-{{ openstack_ansible_version }}
tar: nova-{{ openstack_ansible_version }}.tar.gz
- host_dir: /openstack/venvs/placement-{{ openstack_ansible_version }}
tar: placement-{{ openstack_ansible_version }}.tar.gz
- host_dir: /openstack/venvs/utility-{{ openstack_ansible_version }}
tar: utility-{{ openstack_ansible_version }}.tar.gz
- host_dir: /openstack/venvs/uwsgi-{{ openstack_ansible_version }}-python3
tar: uwsgi-{{ openstack_ansible_version }}-python3.tar.gz
# - host_dir: /openstack/venvs/wheel-builder-python3 # not found in aio
# tar: wheel-builder-python3.tar.gz
- host_dir: /opt/ansible-runtime
tar: ansible-runtime.tar.gz
- host_dir: /etc/ansible
tar: etc-ansible.tar.gz
tasks:
- name: Create cache directory for artifacts
file:
path: /var/cache/osa-{{ openstack_ansible_version }}/
state: directory
mode: "0755"
- name: Create directory for venvs
file:
path: "{{ item.host_dir }}"
state: directory
mode: "0755"
loop: "{{ artifacts }}"
- name: Syncrhonize artifacts to controller
synchronize:
mode: push
dest: /var/cache/
src: artifacts/
- name: Unarchive venvs
unarchive:
src: "/var/cache/osa-{{ openstack_ansible_version }}/{{ item.tar }}"
remote_src: true
dest: "{{ item.host_dir }}"
extra_opts:
- "--strip-components=1"
loop: "{{ artifacts }}"
- name: Fix bash_completion.d
tags: [bash]
file:
name: /etc/bash_completion.d
state: directory
owner: root
group: root
mode: "0755"
- name: Create facts directory
file:
path: /etc/ansible/facts.d/
state: directory
mode: "0755"
- name: Update venv facts
ini_file:
create: true
path: /etc/ansible/facts.d/openstack_ansible.fact
section: "{{ item }}"
option: install_method
value: source
loop: "{{ venv_sections }}"
- name: Update venv facts
ini_file:
create: true
path: /etc/ansible/facts.d/openstack_ansible.fact
section: "{{ item }}"
option: venv_tag
value: "{{ openstack_ansible_version }}"
loop: "{{ venv_sections }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment