Skip to content

Commit

Permalink
synchro with bitbucket 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
frsauvage committed Jul 1, 2020
1 parent 5c2b4d0 commit 8bce0fb
Show file tree
Hide file tree
Showing 50 changed files with 965 additions and 616 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ansible/plugins/inventory/ansible-inventory-cache
/ansible/vars/external-vars

# some readme
*readme.md
*-readme.md
# some tests
test-*
test_*
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile-awx_task.tag
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ansible/awx_task:9.0.1

USER root

ENV MISM_BULLSEQUANA_EDGE_VERSION=2.0.9
ENV MISM_BULLSEQUANA_EDGE_VERSION=2.1.0

COPY ansible.credentials.py /etc/tower/conf.d/credentials.py
COPY ansible.env /etc/tower/conf.d/environment.sh
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile-awx_web.tag
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ansible/awx_web:9.0.1

USER root

ENV MISM_BULLSEQUANA_EDGE_VERSION=2.0.9
ENV MISM_BULLSEQUANA_EDGE_VERSION=2.1.0

# security
COPY ansible.credentials.py /etc/tower/conf.d/credentials.py
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile-zabbix-agent.tag
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM zabbix/zabbix-agent:centos-4.4.1

USER root

ENV MISM_BULLSEQUANA_EDGE_VERSION=2.0.9
ENV MISM_BULLSEQUANA_EDGE_VERSION=2.1.0

ENV PYTHONWARNINGS="ignore:Unverified HTTPS request"

Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile-zabbix-web.tag
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#set base image
FROM zabbix/zabbix-web-nginx-pgsql:centos-4.4.1

ENV MISM_BULLSEQUANA_EDGE_VERSION=2.0.9
ENV MISM_BULLSEQUANA_EDGE_VERSION=2.1.0

COPY items.inc.php /usr/share/zabbix/include/
COPY logo-header.svg /usr/share/zabbix/assets/img/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile-zabbix.tag
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM zabbix/zabbix-server-pgsql:centos-4.4.1

USER root

ENV MISM_BULLSEQUANA_EDGE_VERSION=2.0.9
ENV MISM_BULLSEQUANA_EDGE_VERSION=2.1.0

ENV PYTHONWARNINGS="ignore:Unverified HTTPS request"

Expand Down
5 changes: 5 additions & 0 deletions Dockerfiles/ansible.env
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ POSTGRES_USER=mism
POSTGRES_PASSWORD=mismpass
POSTGRES_DB=mism

NO_PROXY=127.0.0.1,localhost,0.0.0.0:9090,0.0.0.0,ansible,awx,awx_web,awx_task,rabbitmq,awx_postgres,memcached,elasticsearch,kibana,logstash,filebeat,metricbeat,heartbeat,auditbeat,grafana,prometheus,nodeexporter,caddy,cadvisor,alertmanager,172.31.130.224,172.31.60.18,172.31.92.239,172.31.100.156,172.31.60.18,172.31.92.249,172.31.92.222,172.31.92.44,172.31.92.34,172.31.120.13,172.31.120.11,172.31.92.239,172.31.92.49
HTTP_PROXY=http://193.56.47.20:8080
http_proxy=http://193.56.47.20:8080
HTTPS_PROXY=http://193.56.47.20:8080
https_proxy=http://193.56.47.20:8080
2 changes: 1 addition & 1 deletion Dockerfiles/loginModal.partial.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
</div>
</div>
<div class="LoginModal-footer">
version: 2.0.9
version: 2.1.0
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions Dockerfiles/zabbix.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ ZBX_TIMEOUT=9
# ZBX_UNAVAILABLEDELAY=60
# ZBX_UNREACHABLEDELAY=15

NO_PROXY=127.0.0.1,localhost,0.0.0.0:9090,0.0.0.0,ansible,awx,awx_web,awx_task,rabbitmq,awx_postgres,memcached,elasticsearch,kibana,logstash,filebeat,metricbeat,heartbeat,auditbeat,grafana,prometheus,nodeexporter,caddy,cadvisor,alertmanager,172.31.130.224,172.31.60.18,172.31.92.239,172.31.100.156,172.31.60.18,172.31.92.249,172.31.92.222,172.31.92.44,172.31.92.34,172.31.120.13,172.31.120.11,172.31.92.239,172.31.92.49
HTTP_PROXY=http://193.56.47.20:8080
http_proxy=http://193.56.47.20:8080
HTTPS_PROXY=http://193.56.47.20:8080
https_proxy=http://193.56.47.20:8080
7 changes: 7 additions & 0 deletions add_ansible_playbooks_and_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ then
fi
echo "your ansible inventory hosts file is $ANSIBLE_INVENTORY"

if [ ! -f $ANSIBLE_INVENTORY ]
then
touch $ANSIBLE_INVENTORY
echo -e "\033[32m$ANSIBLE_INVENTORY was successfully created\033[0m"
echo -e "\033[32mYou should add your hosts in $ANSIBLE_INVENTORY\033[0m"
fi

add_lines()
{
echo -e "\033[32m---------------------------------------------------------------------------------------\033[0m"
Expand Down
143 changes: 15 additions & 128 deletions ansible/playbooks/openbmc/firmware/activate_firmware_update.yml
Original file line number Diff line number Diff line change
@@ -1,148 +1,35 @@
---
- hosts: all
connection: local
name: Activate Firmwares
connection: local
gather_facts: False
vars_files:
- "{{ ANSIBLE_EXTERNAL_VARS }}"
- "{{ ANSIBLE_PASSWORDS }}"

tasks:
- include_tasks: ../utils/utils_create_token.yml

- name: assert forceoff variable
assert:
that:
- forceoff is defined
fail_msg: "The variable forceoff is NOT defined in inventory (AWX) or vars/external_vars file (Ansible). See readme.md for more details."
success_msg: "The variable forceoff is defined"
run_once: true

- debug:
msg: "forceoff is {{ forceoff }}"
when: forceoff is defined
run_once: true

- name: assert reboot variable
assert:
that:
- reboot is defined
fail_msg: "The variable reboot is NOT defined in inventory (AWX) or vars/external_vars file (Ansible). See readme.md for more details."
success_msg: "The variable reboot is defined"
run_once: true
- include_tasks: ../utils/assert_activate_variables.yml

- debug:
msg: "reboot is {{ reboot }}"
when: reboot is defined
run_once: true

- name: validate activating_countdown variable
assert:
that:
- activating_countdown is defined
fail_msg: "The variable activating_countdown is NOT defined in inventory (AWX) or vars/external_vars file (Ansible). See readme.md for more details."
success_msg: "The variable activating_countdown is defined"
run_once: true

- debug:
msg: "activating_countdown is {{ activating_countdown }}"
when: activating_countdown is defined
run_once: true
- include_tasks: ../utils/utils_create_token.yml

- include_tasks: ../utils/utils_firmware_inventory.yml

- name: render Ready Firmwares
debug:
msg: "Ready {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})"
when: item.value.Activation is defined and item.value.Activation == "xyz.openbmc_project.Software.Activation.Activations.Ready"
with_dict: "{{ firmware_inventory }}"

- name: render old Active Firmwares BEFORE activation
debug:
msg: "Active {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})"
when: item.value.Activation is defined and item.value.Activation == "xyz.openbmc_project.Software.Activation.Activations.Active"
with_dict: "{{ firmware_inventory }}"
- include_tasks: ../utils/should_poweroff.yml

- include_tasks: ../utils/utils_active_firmware_update.yml

- include_tasks: ../utils/utils_firmware_inventory.yml

- name: render Requested for Active Firmwares AFTER Activation
debug:
msg: "Requested Activation {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})"
when: item.value.RequestedActivation is defined and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"
with_dict: "{{ firmware_inventory }}"
- include_tasks: ../utils/should_reboot.yml

- name: check Activation Failures AFTER Activation
- name: Fails on Failed state
fail:
msg: "Failure in activation for {{item.value.Purpose}} - {{item.value.Version}}"
when: item.value.Activation is defined and item.value.Activation == 'xyz.openbmc_project.Software.Activation.Activations.Failed' and item.value.RequestedActivation is defined and item.value.RequestedActivation =='xyz.openbmc_project.Software.Activation.RequestedActivations.Active'
with_dict: "{{ firmware_inventory }}"

- name: render Requested for Active Firmwares AFTER Activation
debug:
msg: "Requested Activation {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})"
when: item.value.RequestedActivation is defined and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"
with_dict: "{{ firmware_inventory }}"

- name: reboot BMC
uri:
url: https://{{ baseuri }}/xyz/openbmc_project/state/bmc0/attr/RequestedBMCTransition
method: PUT
validate_certs: no
headers:
X-Auth-Token: "{{ x_token }}"
Content-Type: "application/json"
body:
data: xyz.openbmc_project.State.BMC.Transition.Reboot
body_format: json
when: reboot == True and item.value.Purpose is defined and item.value.RequestedActivation is defined and item.value.Purpose == "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"
msg: "Fails on {{item.value.Purpose}} - {{item.value.Version}} - {{item.value.Activation}} - {{item.value.RequestedActivation}}"
when: >
( item.value.RequestedActivation is defined and
not item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.None"
)
or
( item.value.Activation is defined and
item.value.Activation == "xyz.openbmc_project.Software.Activation.Activations.Failed"
)
with_dict: "{{ firmware_inventory }}"

- name: pause {{ reboot_countdown }} minutes for BMC to reboot
pause:
minutes: "{{ reboot_countdown }}"
when: reboot == True and item.value.Purpose is defined and item.value.RequestedActivation is defined and item.value.Purpose == "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"
with_dict: "{{ firmware_inventory }}"

- name: pause {{ activating_countdown }} seconds while activating firmware updates
pause:
seconds: "{{ activating_countdown }}"
when: item.value.Purpose is defined and item.value.RequestedActivation is defined and not item.value.Purpose == "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"
with_dict: "{{ firmware_inventory }}"

- include_tasks: ../utils/utils_create_token.yml

- name: get new firmware inventory
uri:
url: https://{{ baseuri }}/xyz/openbmc_project/software/enumerate
method: GET
validate_certs: no
headers:
X-Auth-Token: "{{ x_token }}"
register: result_firmware_inventory

- set_fact:
new_firmware_inventory: "{{ result_firmware_inventory.json.data }}"

- name: check key is defined in New Active Firmwares
debug:
msg: "Failure in activation for {{ item }}"
verbosity: 2
with_items: "{{ firmware_inventory.keys() }}"
when: not new_firmware_inventory[item] is defined

- name: check New Active Firmwares
fail:
msg: "Failure in activation for {{ new_firmware_inventory[item].value.Purpose }} - {{ new_firmware_inventory[item].value.Version }}"
when: new_firmware_inventory[item] is defined and new_firmware_inventory[item].value is defined and new_firmware_inventory[item].value.Version is defined and new_firmware_inventory[item].value.Purpose is defined and new_firmware_inventory[item].value.Activation is defined and not new_firmware_inventory[item].Activation == 'xyz.openbmc_project.Software.Activation.Activations.Active' and new_firmware_inventory[item].RequestedActivation is defined and not new_firmware_inventory[item].RequestedActivation == 'xyz.openbmc_project.Software.Activation.RequestedActivations.None'
with_items: "{{ firmware_inventory.keys() }}"

- include_tasks: ../utils/utils_firmware_inventory.yml

- name: check Activation Failures
fail:
msg: "Failure in activation for {{item.value.Purpose}} - {{item.value.Version}}"
when: item.value.Activation is defined and item.value.Activation == 'xyz.openbmc_project.Software.Activation.Activations.Failed' and item.value.RequestedActivation is defined and item.value.RequestedActivation =='xyz.openbmc_project.Software.Activation.RequestedActivations.Active'
with_dict: "{{ firmware_inventory }}"

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- "{{ ANSIBLE_PASSWORDS }}"

tasks:
- name: assert technical_state_path variable
- name: Assert technical_state_path variable
assert:
that:
- technical_state_path is defined
Expand All @@ -23,7 +23,5 @@

- include_tasks: ../utils/utils_create_token.yml

- include_tasks: ../utils/utils_firmware_inventory.yml

- include_tasks: ../utils/utils_evaluate_firmware_update.yml

Loading

0 comments on commit 8bce0fb

Please sign in to comment.