[CI] Do not use the kolla user

The kolla user is not obligatory and the docs default to keeping
using the existing users.

Needed-By: https://review.opendev.org/c/openstack/ansible-collection-kolla/+/854985
Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/855071
Change-Id: I917f493d395cc7efcbf95bc55af8191d70ec3edb
This commit is contained in:
Radosław Piliszek 2022-08-29 12:12:43 +00:00
parent 1b74b18c2e
commit 166ee3d20c
4 changed files with 14 additions and 35 deletions

View File

@ -283,30 +283,9 @@
- name: generate passwords
command: "{{ kolla_ansible_venv_path }}/bin/kolla-genpwd"
- name: slurp kolla passwords
slurp:
src: /etc/kolla/passwords.yml
register: passwords_yml
- name: write out kolla SSH private key
copy:
content: "{{ (passwords_yml.content | b64decode | from_yaml).kolla_ssh_key.private_key }}"
dest: ~/.ssh/id_rsa_kolla
mode: 0600
- name: authorise kolla public key for zuul user
authorized_key:
user: "{{ ansible_env.USER }}"
key: "{{ (passwords_yml.content | b64decode | from_yaml).kolla_ssh_key.public_key }}"
# Delegate to each host in turn. If more tasks require execution on all
# hosts in future, break out into a separate play.
with_inventory_hostnames:
- all
delegate_to: "{{ item }}"
- name: Record the running state of the environment as seen by the setup module
shell:
cmd: "{{ kolla_ansible_venv_path }}/bin/ansible all -i {{ kolla_inventory_path }} -e ansible_user={{ ansible_user }} -m setup > /tmp/logs/ansible/initial-setup"
cmd: "{{ kolla_ansible_venv_path }}/bin/ansible all -i {{ kolla_inventory_path }} -m setup > /tmp/logs/ansible/initial-setup"
- name: Set facts for actions
set_fact:

View File

@ -143,7 +143,7 @@ setup_openstack_clients
RAW_INVENTORY=/etc/kolla/inventory
source $KOLLA_ANSIBLE_VENV_PATH/bin/activate
kolla-ansible -i ${RAW_INVENTORY} -e ansible_user=$USER -vvv bootstrap-servers &> /tmp/logs/ansible/bootstrap-servers
kolla-ansible -i ${RAW_INVENTORY} -vvv bootstrap-servers &> /tmp/logs/ansible/bootstrap-servers
deactivate
prepare_images

View File

@ -1,6 +1,6 @@
[storage]
{% for host in hostvars %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
# Ceph-Ansible hosts

View File

@ -8,15 +8,15 @@
[control]
{% if scenario == 'masakari' %}
{% for host in hostvars if host in ['primary'] %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% elif scenario == 'monasca' %}
{% for host in hostvars if host in ['primary', 'secondary1', 'secondary2'] %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% else %}
{% for host in hostvars %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% endif %}
@ -32,40 +32,40 @@ control
[compute]
{% if scenario == 'masakari' %}
{% for host in hostvars if host in ['ternary1', 'ternary2'] %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% else %}
{% for host in hostvars %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% endif %}
[storage]
{% for host in hostvars %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
[monitoring]
{% if scenario == 'monasca' %}
{% for host in hostvars if host in ['secondary3', 'secondary4', 'secondary5'] %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% else %}
{% for host in hostvars %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% endif %}
[deployment]
{% for host in hostvars %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endfor %}
{% if scenario == 'cells' %}
{% for host in hostvars %}
{% set cell_name = 'cell' ~ loop.index %}
[{{ cell_name }}]
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }} mariadb_shard_id={{ loop.index0 % 2 }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} mariadb_shard_id={{ loop.index0 % 2 }}
[{{ cell_name }}:vars]
nova_cell_name = {{ cell_name }}
@ -139,7 +139,7 @@ control
[hacluster]
{% for host in hostvars %}
{% if host in ['primary', 'secondary'] %}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }} ansible_user=kolla ansible_ssh_private_key_file={{ ansible_env.HOME ~ '/.ssh/id_rsa_kolla' }}
{{ host }} ansible_host={{ hostvars[host]['ansible_host'] }}
{% endif %}
{% endfor %}