Skip to content

Commit

Permalink
synchro with bitbucket 2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
frsauvage committed Jan 6, 2020
1 parent 2b561d9 commit 8c58e9a
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 59 deletions.
3 changes: 1 addition & 2 deletions ansible/inventory/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#library = /usr/share/my_modules/
#module_utils = /usr/share/my_module_utils/
#library = /usr/share/ansible/plugins/modules/
#module_utils = /usr/share/ansible/plugins/modules/
module_utils = /usr/share/ansible/plugins/modules/
#remote_tmp = ~/.ansible/tmp
#local_tmp = ~/.ansible/tmp
#plugin_filters_cfg = /etc/ansible/plugin_filters.yml
Expand Down Expand Up @@ -76,7 +76,6 @@ host_key_checking = False
#stdout_callback = skippy
stdout_callback = mismunixy


## Ansible ships with some plugins that require whitelisting,
## this is done to avoid running all of a type by default.
## These setting lists those that you want enabled for your system.
Expand Down
1 change: 0 additions & 1 deletion ansible/inventory/hosts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[all:vars]
host="{{inventory_hostname}}"


#[openbmc]
# <here an IP address> baseuri="{{host}}" username=<here bmc username> password=<here bmc password>

Expand Down
2 changes: 1 addition & 1 deletion ansible/playbooks/playbooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inventories:
hosts:
- name: <here an ip address>
variables: '{ "baseuri": "{{inventory_hostname}}", "username": "<here bmc user name>", "password": "{{ here_your_encryted_password_variable }}" }'
variables: '{ "ANSIBLE_PASSWORDS": "/etc/ansible/vars/passwords.yml", "ANSIBLE_EXTERNAL_VARS": "/etc/ansible/vars/external_vars.yml", "technical_state_path": "/host/mnt", "forceoff": True, "reboot": True, "rsyslog_server_ip": "0.0.0.0", "rsyslog_server_port": "514", "reboot_countdown": "3", "poweron_countdown": "15", "poweroff_countdown": "15" }'
variables: '{ "ANSIBLE_PASSWORDS": "/etc/ansible/vars/passwords.yml", "technical_state_path": "/host/mnt", "forceoff": True, "reboot": True, "rsyslog_server_ip": "0.0.0.0", "rsyslog_server_port": "514", "reboot_countdown": "3", "poweron_countdown": "15", "poweroff_countdown": "15" }'

credentials:
- name: Bull Sequana Edge Vault
Expand Down
7 changes: 4 additions & 3 deletions ansible/vars/external_vars.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Update and Activate playbooks use these variables if needed
forceoff: True
reboot: True
forceoff: False
reboot: False

# Count down before checking a successfull reboot in MINUTES
reboot_countdown: 3
Expand All @@ -10,7 +10,8 @@ poweron_countdown: 15
poweroff_countdown: 15

# Set a path to a Bull Technical State file
technical_state_path: /mnt
# uncomment for CLI Ansible ONLY (for AWX, please use the external vars in the graphical AWX inventory externale vars)
# technical_state_path: /mnt

# Define rsyslog ip and port
# default rsyslog port is 514
Expand Down
2 changes: 1 addition & 1 deletion check_prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ then
exit -1
fi

echo "checking docker version prerequisite"
echo "checking docker compose prerequisite"
docker_compose_version=$(docker-compose --version|grep version)
if [ -z "$docker_compose_version" ]
then
Expand Down
24 changes: 15 additions & 9 deletions docker_compose_awx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ services:
- ./ansible/inventory:/var/lib/awx/inventory:rw
- ./ansible/inventory:/etc/ansible:rw
- ./ansible/vars:/etc/ansible/vars:rw
- ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml:/usr/lib/python3.6/site-packages/ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml
- ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml:/usr/share/ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml
- ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.py:/usr/lib/python3.6/site-packages/ansible/plugins/inventory/redfish_plugin_ansible_inventory.py
# - ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml:/usr/lib/python3.6/site-packages/ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml
# - ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml:/usr/share/ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml
# - ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.py:/usr/lib/python3.6/site-packages/ansible/plugins/inventory/redfish_plugin_ansible_inventory.py
# - ./ansible/plugins/inventory/:/usr/share/ansible/plugins/inventory
- ./ansible/plugins/callback/ansible_stdout_compact_logger:/usr/share/ansible/plugins/callback/ansible_stdout_compact_logger
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py:/usr/lib/python3.6/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/lib/python3.6/site-packages/ansible/module_utils/atos_openbmc_utils.py:ro
# - ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py:/usr/lib/python3.6/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py:ro
# - ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/lib/python3.6/site-packages/ansible/module_utils/atos_openbmc_utils.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py:/usr/share/ansible/plugins/modules/atos_openbmc.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/share/ansible/plugins/module_utils/atos_openbmc_utils.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/share/ansible/plugins/modules/__init__.py:ro
- ./ansible/awx-ssl:/var/lib/awx-ssl:rw
- /:/host:ro
env_file:
Expand All @@ -53,12 +56,15 @@ services:
- ./ansible/inventory:/var/lib/awx/inventory:rw
- ./ansible/inventory:/etc/ansible:rw
- ./ansible/vars:/etc/ansible/vars:rw
- ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml:/usr/share/ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml
- ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.py:/usr/lib/python3.6/site-packages/ansible/plugins/inventory/redfish_plugin_ansible_inventory.py
# - ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml:/usr/share/ansible/plugins/inventory/redfish_plugin_ansible_inventory.yml
# - ./ansible/plugins/inventory/redfish_plugin_ansible_inventory.py:/usr/lib/python3.6/site-packages/ansible/plugins/inventory/redfish_plugin_ansible_inventory.py
# - ./ansible/plugins/inventory/:/usr/share/ansible/plugins/inventory
- ./ansible/plugins/callback/ansible_stdout_compact_logger:/usr/share/ansible/plugins/callback/ansible_stdout_compact_logger
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py:/usr/lib/python3.6/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/lib/python3.6/site-packages/ansible/module_utils/atos_openbmc_utils.py:ro
# - ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py:/usr/lib/python3.6/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py:ro
# - ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/lib/python3.6/site-packages/ansible/module_utils/atos_openbmc_utils.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py:/usr/share/ansible/plugins/modules/atos_openbmc.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/share/ansible/plugins/module_utils/atos_openbmc_utils.py:ro
- ./ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py:/usr/share/ansible/plugins/modules/__init__.py:ro
- ./ansible/awx-ssl:/var/lib/awx-ssl:rw
- /:/host:ro
env_file:
Expand Down
16 changes: 8 additions & 8 deletions install_awx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
. ./proxy.sh
. ./versions.sh

export docker_image=`docker images |grep 'bullsequana-edge-system-management_awx_web' |awk '{ print $3; }'`
export docker_image=`docker images |grep $MISM_BULLSEQUANA_EDGE_VERSION |grep 'bullsequana-edge-system-management_awx_web' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f bullsequana-edge-system-management_awx_web.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -16,7 +16,7 @@ then
fi
fi

export docker_image=`docker images |grep 'bullsequana-edge-system-management_awx_task' |awk '{ print $3; }'`
export docker_image=`docker images |grep $MISM_BULLSEQUANA_EDGE_VERSION |grep 'bullsequana-edge-system-management_awx_task' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f bullsequana-edge-system-management_awx_task.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -26,7 +26,7 @@ then
fi
fi

export docker_image=`docker images |grep 'ansible/awx_web' |awk '{ print $3; }'`
export docker_image=`docker images |grep $AWX_BULLSEQUANA_EDGE_VERSION |grep 'ansible/awx_web' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f awx_web.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -36,7 +36,7 @@ then
fi
fi

export docker_image=`docker images |grep 'ansible/awx_task' |awk '{ print $3; }'`
export docker_image=`docker images |grep $AWX_BULLSEQUANA_EDGE_VERSION |grep 'ansible/awx_task' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f awx_task.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -46,7 +46,7 @@ then
fi
fi

export docker_image=`docker images |grep 'rabbitmq' |awk '{ print $3; }'`
export docker_image=`docker images |grep $RABBITMQ_AWX_BULLSEQUANA_EDGE_VERSION |grep 'rabbitmq' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f rabbitmq.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -56,7 +56,7 @@ then
fi
fi

export docker_image=`docker images |grep 'memcached' |awk '{ print $3; }'`
export docker_image=`docker images |grep $MEMCACHED_AWX_BULLSEQUANA_EDGE_VERSION |grep 'memcached' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f memcached.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -66,7 +66,7 @@ then
fi
fi

export docker_image=`docker images |grep 'postgres' |awk '{ print $3; }'`
export docker_image=`docker images |grep $POSTGRES_AWX_BULLSEQUANA_EDGE_VERSION |grep 'postgres' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f postgres.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -76,7 +76,7 @@ then
fi
fi

export docker_image=`docker images |grep 'pgadmin4' |awk '{ print $3; }'`
export docker_image=`docker images |grep $PGADMIN_AWX_BULLSEQUANA_EDGE_VERSION |grep 'pgadmin4' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f pgadmin4.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand Down
47 changes: 20 additions & 27 deletions install_playbooks_and_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ add_lines()
{
echo -e "\033[32m---------------------------------------------------------------------------------------\033[0m"
echo -e "\033[32mPlease change yourself the following configuration in your $ANSIBLE_CONFIG:\033[0m"
echo "# for a better Atos sensors / log / yaml rendering"
echo "# MADATORY: for atos plugin to work, uncomment line at the begining of thefile:"
echo -e "\033[32mmodule_utils = /usr/share/ansible/plugins/modules\033[0m"
echo "# OPTION for a better Atos sensors / log / yaml rendering"
echo -e "stdout_callback = \033[31mmismunixy\033[0m"
echo "# if you wish a more human-readable rendering"
echo "# OPTION if you wish a more human-readable rendering"
echo "See https://docs.ansible.com/ansible/2.5/plugins/callback.html#managing-adhoc"
echo -e "bin_ansible_callbacks = \033[31mTrue\033[0m"
echo "# to enable Atos python3 playbboks"
Expand Down Expand Up @@ -68,39 +70,30 @@ echo -e "\033[32mANSIBLE_EXTERNAL_VARS=$ANSIBLE_EXTERNAL_VARS\033[0m"
if [ ! -d "/usr/share/ansible/plugins/callback" ]
then
mkdir /usr/share/ansible/plugins/callback
cp -r ansible/plugins/callback/ansible_stdout_compact_logger /usr/share/ansible/plugins/callback/ansible_stdout_compact_logger
fi
cp -r ansible/plugins/callback/ansible_stdout_compact_logger /usr/share/ansible/plugins/callback/ansible_stdout_compact_logger

# ansible plugin inventory is copied in default directory /usr/lib/python<major>.<minor>/site-packages/ansible/modules
# you can adapt it if you have another ansible plugin inventory directory

if [ -d "/usr/lib/python2.7/site-packages/ansible/modules/remote_management" ]
# ansible plugin module is copied in default shared directory /usr/share/ansible/plugins/modules/
# you can adapt it if you have another ansible plugin module directory

if [ ! -d "/usr/share/ansible" ]
then
mkdir /usr/share/ansible
fi

if [ ! -d "/usr/share/ansible/plugins" ]
then
if [ ! -d "/usr/lib/python2.7/site-packages/ansible/modules/remote_management/openbmc" ]
then
mkdir /usr/lib/python2.7/site-packages/ansible/modules/remote_management/openbmc
fi
cp ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py /usr/lib/python2.7/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py
echo "atos_openbmc.py copied in Ansible modules: /usr/lib/python2.7/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py"
cp ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py /usr/lib/python2.7/site-packages/ansible/module_utils/atos_openbmc_utils.py
echo "atos_openbmc_utils.py copied in Ansible module_utils /usr/lib/python2.7/site-packages/ansible/module_utils/atos_openbmc_utils.py"
cp ansible/plugins/modules/remote_management/openbmc/__init__.py /usr/lib/python2.7/site-packages/ansible/modules/remote_management/openbmc/__init__.py
exit 0
mkdir /usr/share/ansible/plugins
fi

if [ -d "/usr/lib/python3.6/site-packages/ansible/modules/remote_management" ]
if [ ! -d "/usr/share/ansible/plugins/modules" ]
then
if [ ! -d "/usr/lib/python2.7/site-packages/ansible/modules/remote_management/openbmc" ]
then
mkdir /usr/lib/python2.7/site-packages/ansible/modules/remote_management/openbmc
fi
cp ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py /usr/lib/python3.6/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py
echo "atos_openbmc.py copied in Ansible modules: /usr/lib/python3.6/site-packages/ansible/modules/remote_management/openbmc/atos_openbmc.py"
cp ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py /usr/lib/python3.6/site-packages/ansible/module_utils/atos_openbmc_utils.py
echo "atos_openbmc_utils.py copied in Ansible module_utils /usr/lib/python3.6/site-packages/ansible/module_utils/atos_openbmc_utils.py"
cp ansible/plugins/modules/remote_management/openbmc/__init__.py /usr/lib/python3.6/site-packages/ansible/modules/remote_management/openbmc/__init__.py
exit 0
mkdir /usr/share/ansible/plugins/modules
fi

echo -e "\033[31mError: NO Ansible modules/module_utils directory found"
echo "you should manually copy atos_openbmc modules and module_utils"
cp ansible/plugins/modules/remote_management/openbmc/atos_openbmc.py /usr/share/ansible/plugins/modules/atos_openbmc.py
cp ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py /usr/share/ansible/plugins/modules/atos_openbmc_utils.py
cp ansible/plugins/modules/remote_management/openbmc/atos_openbmc_utils.py /usr/share/ansible/plugins/modules/__init__.py
14 changes: 7 additions & 7 deletions install_zabbix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ echo $timezone
. ./proxy.sh
. ./versions.sh

export docker_image=`docker images |grep 'bullsequana-edge-system-management_zabbix-web' |awk '{ print $3; }'`
export docker_image=`docker images |grep $MISM_BULLSEQUANA_EDGE_VERSION |grep 'bullsequana-edge-system-management_zabbix-web' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f bullsequana-edge-system-management_zabbix-web.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -36,7 +36,7 @@ then
fi
fi

export docker_image=`docker images |grep 'bullsequana-edge-system-management_zabbix-server' |awk '{ print $3; }'`
export docker_image=`docker images |grep $MISM_BULLSEQUANA_EDGE_VERSION |grep 'bullsequana-edge-system-management_zabbix-server' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f bullsequana-edge-system-management_zabbix-server.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -46,7 +46,7 @@ then
fi
fi

export docker_image=`docker images |grep 'bullsequana-edge-system-management_zabbix-agent' |awk '{ print $3; }'`
export docker_image=`docker images |grep $MISM_BULLSEQUANA_EDGE_VERSION |grep 'bullsequana-edge-system-management_zabbix-agent' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f bullsequana-edge-system-management_zabbix-agent.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -56,7 +56,7 @@ then
fi
fi

export docker_image=`docker images |grep 'zabbix-server-pgsql' |awk '{ print $3; }'`
export docker_image=`docker images |grep $ZABBIX_BULLSEQUANA_EDGE_VERSION |grep 'zabbix-server-pgsql' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f zabbix-server-pgsql.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -66,7 +66,7 @@ then
fi
fi

export docker_image=`docker images |grep 'zabbix-web-nginx-pgsql' |awk '{ print $3; }'`
export docker_image=`docker images |grep $ZABBIX_BULLSEQUANA_EDGE_VERSION |grep 'zabbix-web-nginx-pgsql' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f zabbix-web-nginx-pgsql.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -76,7 +76,7 @@ then
fi
fi

export docker_image=`docker images |grep 'zabbix-agent' |awk '{ print $3; }'`
export docker_image=`docker images |grep $ZABBIX_BULLSEQUANA_EDGE_VERSION |grep 'zabbix-agent' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f zabbix-agent.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand All @@ -86,7 +86,7 @@ then
fi
fi

export docker_image=`docker images |grep 'postgres' |awk '{ print $3; }'`
export docker_image=`docker images |grep $POSTGRES_ZABBIX_BULLSEQUANA_EDGE_VERSION |grep 'postgres' |awk '{ print $3; }'`
if [ -z "$docker_image" ]
then
if [ -f postgres.$MISM_BULLSEQUANA_EDGE_VERSION.tar ]
Expand Down
21 changes: 21 additions & 0 deletions remove_awx_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,27 @@ then
fi
fi

docker_image=$(docker images |grep 'ansible/awx_web')
if [ ! -z "$docker_image" ]
then
docker_image=$(echo $docker_image |awk '{ print $3; }')
if [ ! -z "$docker_image" ]
then
docker image rmi -f "$docker_image"
fi
fi


docker_image=$(docker images |grep 'ansible/awx_task')
if [ ! -z "$docker_image" ]
then
docker_image=$(echo $docker_image |awk '{ print $3; }')
if [ ! -z "$docker_image" ]
then
docker image rmi -f "$docker_image"
fi
fi

docker_image=$(docker images |grep 'page/pgadmin4')
if [ ! -z "$docker_image" ]
then
Expand Down

0 comments on commit 8c58e9a

Please sign in to comment.