#ansible (2023-06)
Discussions related to ansible configuration management
2023-06-05
![Dan Herrington avatar](https://avatars.slack-edge.com/2022-05-06/3490784423170_3456a9a0a9e500d7f84d_72.png)
Hey all, I’m wondering if anybody here uses ansible for some system ops tasks like backup? I’m migrating those scripts off of cron to airflow, but then thought they could also be executed from ansible. I’d still use airflow to schedule the ansible playbook, but then create a group of servers on that the backup playbook gets applied to.
![Hao Wang avatar](https://secure.gravatar.com/avatar/aa01de6ab42f1576bbb56a203c660939.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0013-72.png)
I used Ansible and also fixed some bugs before
![Hao Wang avatar](https://secure.gravatar.com/avatar/aa01de6ab42f1576bbb56a203c660939.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0013-72.png)
yeah, Airflow can run Ansible task, most of time I used CICD pipeline
![Dan Herrington avatar](https://avatars.slack-edge.com/2022-05-06/3490784423170_3456a9a0a9e500d7f84d_72.png)
2023-06-06
![Andrew Miskell avatar](https://secure.gravatar.com/avatar/3fc3caad5890d3f266565dd9df2095af.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0011-72.png)
Is it possible to configure a set of host variables for all hosts in an inventory?
I’m using aws_ec2 plugin and want to set the following variables for all hosts so I don’t have to repeat them over and over in each playbook since we’re using aws_ssm connection plugins to connect to all our ec2 hosts.
ansible_connection: aws_ssm ansible_aws_ssm_region: us-east-1 ansible_aws_ssm_bucket_name: <bucket name> ansible_remote_tmp: /tmp/.ansible ansible_python_interpreter: python3
I checked the documentation and below seems right based on the docs, but it’s not working ansible is still trying to connect via ssh.
all:
vars:
ansible_connection: aws_ssm
ansible_aws_ssm_region: us-east-1
ansible_aws_ssm_bucket_name: <bucket-name>
ansible_remote_tmp: /tmp/.ansible
ansible_python_interpreter: python3
plugin: amazon.aws.aws_ec2
regions:
- us-east-1
keyed_groups:
- key: tags.Application
separator: ''
- key: tags.Tenant
separator: ''
hostnames:
- name: 'tag:Name'
compose:
ansible_host: instance_id
![Hao Wang avatar](https://secure.gravatar.com/avatar/aa01de6ab42f1576bbb56a203c660939.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0013-72.png)
ansible_connection
needs to be associated with a host in inventory file