Outils pour utilisateurs

Outils du site


tech:ansible_awx_-_tower_cli

Ceci est une ancienne révision du document !


Ansible AWX - Tower Cli

Voir :

pip3 install awxkit
awx --help

Connexion

export TOWER_HOST=https://aap.acme.local
export TOWER_USERNAME=jean
export TOWER_VERIFY_SSL=false
read -s TOWER_PASSWORD
#awx login --conf.host "$TOWER_HOST" --conf.username "$TOWER_USERNAME" --conf.password "$TOWER_PASSWORD" -k
awx login

Export

awx --conf.host $TOWER_HOST --conf.token "TOKEN" export --projects "PLOP" > projects_PLOP.json
awx --conf.host $TOWER_HOST --conf.token "TOKEN" export --inventory "PLOP" > inventory_PLOP.json
 
awx export --job_templates 42
awx export --job_template "plop" > tpl_plop.json
awx export --credentials "IOPS_GIT" > credentials_IOPS_GIT.json

Vérif

for fic in tpl_*.json* ; do awx export --job_templates "$(cat $fic |jq -r '.job_templates[0].name')" > $fic.verif ; done

Import

export TOWER_HOST=https://aap.acme.local
awx login
awx import -v < tpl_388.json 2>err.log
awx import < credentials_IOPS_GIT.json
awx import < tpl_388.json

Autres commandes

awx jobs list --controller_node "old-aap.acme.local" -f human --filter id,name,started,completed --all
awx job_templates get 176
 
awx job list -f human
awx jobs list --all -f human --filter 'id,name,status'
awx job stdout 6

Alternatives à Ansible Tower / APP :

Voir aussi

tower-job.sh
#!/bin/bash
 
# tower-job
# https://gist.github.com/philcryer/fdce90d0b06517a49ff2fdba41b579df
 
# Variables
tower_template_id=574
 
# Directions
#
# install tower-cli
#   sudo pip install tower-cli
#
# put this file in a root of your project
#   {{ project_root }}/tower-job
#
# create a file ~/.tower-cli.cfg with contents:
#
#   [general]
#   host = fqdn.yourhost.com
#   username = your-username
#   password = ssssshhhhhhhh
#
# add variables from your tower survey to a vars file. we'll use group_vars/tower-job.yml
#   ---
#   survey_env: "DEV"
#   survey_version: "2.0"
#   survey_mychart_customer: "bob"
#
# define your job template ID # in variables above
#   job_template_id=574
#
# make this file executable
#   chmod 755 tower-job
#
# then run it
#   ./tower-job
 
set -e
 
if [ ! -d 'group_vars' ]; then
    echo "No group_vars found, run this out of root of project"; exit 1
fi
 
tower-cli job launch --job-template=$tower_template_id --extra-vars="@group_vars/tower-job.yml" | tee tower-job.pid
job_id=$(cat tower-job.pid | tail -n2 | head -n1 | awk '{print $1}')
rm tower-job.pid
while [ $(tower-cli job list --status=running | grep $job_id | wc -l) -lt '1' ]; do
    echo -n "-"; sleep 5;
done;
 
tower-cli job monitor $job_id
 
exit 0

https://www.insentra.com.au/protecting-the-automation-engine-backup-for-ansible-awx-project/

Voir aussi :

API Tower / AWS

Access Control - RBAC

Authentification Controle d'acces (Authorization) Imputabilité (Accoutability) Tracabilité (Traceability) Disponibilité (Availability) Confidentialité (Confidentiality)

Habilitation : Vidéo - Infuser du métier dans les autorisations avec ReBAC (Geoffroy BRAUN et Pauline JAMIN)

RBAC :

Voir :

Execute Role

https://www.unixarena.com/2019/03/ansible-tower-awx-configuring-role-based-access-rbac.html/

How Can I Map Organizations and Teams with LDAP in Ansible Tower?

Ansible Tower Teams Teams provide a means to implement role-based access control schemes and delegate responsibilities across organizations.


tower-cli workflow_job list -W 2389 --status running

Ansible Semaphore

curl -X 'GET' -H 'Authorization: Bearer nb8jzkj3rcgoxej99onocburcsstghqhalnbsq5v6mg=' -H 'accept: text/plain; charset=utf-8' 'http://localhost:3000/api/project/1/templates' | jq .
tech/ansible_awx_-_tower_cli.1756713958.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki