This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
main.yml
108 lines (96 loc) · 3.44 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
- name: Gather ansible distribution
setup:
gather_subset: "!min,distribution"
when: ansible_distribution is not defined
- name: Cache tempest network cidr
set_fact:
tempest_cidr: "{{ undercloud_network_cidr }}"
when: use_os_tempest is defined
# tasks file for all_in_one
# standalone params
- name: Create the standalone params
template:
src: "{{ standalone_config }}"
dest: "{{ working_dir}}/standalone_parameters.yaml"
mode: 0755
- name: Create container parameters script
template:
src: "{{ standalone_container_prep_script }}"
dest: "{{ working_dir }}/standalone-container-prep.sh"
mode: "0755"
- name: Run container prepare
shell: >
set -o pipefail &&
{{ working_dir }}/standalone-container-prep.sh 2>&1 {{ timestamper_cmd }} > {{ working_dir }}/{{ standalone_container_prep_log }}
- name: Add updates to container-prepare-parameters.yaml
when:
- standalone_container_prep_updates
# We don't want to update 'centos-binary' containers with 'fedora' repos
- docker_prep_prefix is search(ansible_distribution|lower)
vars:
yaml_file: "{{ working_dir }}/containers-prepare-parameters.yaml"
container_image_prep_updates:
- push_destination: "{{ local_docker_registry_host }}:8787"
tag_from_label: null
modify_role: tripleo-modify-image
modify_append_tag: "{{ update_containers_append_tag }}"
modify_only_with_labels:
- kolla_version
modify_vars:
tasks_from: yum_update.yml
yum_repos_dir_path: /etc/yum.repos.d
update_repo: "{{ standalone_container_prep_update_repo }}"
initial_dict: |
{{ lookup('file', yaml_file) | from_yaml }}
merged_dict:
parameter_defaults:
DockerInsecureRegistryAddress:
- "{{ local_docker_registry_host }}:8787"
ContainerImagePrepare:
- |
{{ initial_dict.parameter_defaults.ContainerImagePrepare |
combine(container_image_prep_updates, recursive=true) }}
copy:
content: "{{ merged_dict | to_nice_yaml }}"
dest: "{{ yaml_file }}"
backup: true
- name: Create the deploy command for standalone
template:
src: "{{ standalone_deploy_script }}"
dest: "{{ working_dir}}/standalone.sh"
mode: 0755
- name: Deploy the standalone
shell: >
set -o pipefail &&
{{ working_dir }}/standalone.sh 2>&1 {{ timestamper_cmd }} > {{ working_dir }}/{{ standalone_deploy_log }}
- when: standalone_ansible_lint|default(false)|bool
vars:
quickstart_venv: "{{ lookup('env','OPT_WORKDIR') }}"
block:
- name: Install ansible-lint
pip:
name: ansible-lint
state: latest
virtualenv: "{{ quickstart_venv }}"
- name: List playbooks
shell: "find $(ls -rtd {{ working_dir }}/undercloud-ansible-* | tail -1)/ -name '*playbook*.yaml'"
register: playbooks
# We ignore (for now) the lint (rc==2), only catch syntax error
# (rc==1).
- name: Lint playbooks
shell: >
source {{ quickstart_venv }}/bin/activate;
exec 1>>{{ working_dir }}/{{standalone_ansible_lint_log}};
exec 2>&1;
echo LINTING {{item}};
ansible-lint -v {{item}};
rc=$?;
echo DONE rc=$rc;
exit $rc
register: lint_result
environment:
ANSIBLE_LIBRARY: |
/usr/share/ansible-modules/:{{lookup('env', 'ANSIBLE_LIBRARY')}}
with_items: "{{ playbooks.stdout_lines }}"
failed_when: lint_result.rc == 1