Questions tagged [ansible]

Use this tag for questions about Ansible, an open-source automation engine, related to using Ansible for topics such as cloud provisioning, configuration management, application deployment, etc.

Filter by
Sorted by
Tagged with
0 votes
1 answer
28 views

Conflicts while building AWX-EE custom image

I'm currently building AWX EE custom image with the latest available but it seems latest versions got some conflicts with pip modules. My custom image was working great in July (awx-ee version 22.X 23....
motorbass's user avatar
  • 113
1 vote
1 answer
18 views

Creating a cmd task with all the private ip address details collected from gather_facts

I am running an ansible playbook from my local laptop to AWS connecting on the public IP address. The infra is being spun up by terraform so i dont know the private IP address before hand. I have ...
ranjit abraham's user avatar
1 vote
1 answer
59 views

Ansible inventory for restart on worker node

I looking to execute a simple reboot via Ansible using its playbook - name: Worker-node Reboot hosts: node1 gather_facts: no remote_user: team become: true tasks: - name: Reboot the ...
Terra's user avatar
  • 13
0 votes
1 answer
26 views

Trying to Create a Docker Ansible lab and Cant SSH

I'm trying to setup a mini ansible lab with docker containers. I have 1 Rockylinux based container as the ansible controller, and then (for right now) 1 Rockylinux based container as the host. For ...
egkennedy93's user avatar
1 vote
1 answer
542 views

How to reload the Firewalld service using Ansible?

I have added some rules to firewalld on CentOS via Ansible. But I need to reload the firewalld daemon for the service to work properly and permanently. Is there a way to do this in Ansible? Here is my ...
Ali's user avatar
  • 111
0 votes
0 answers
20 views

How to set up an "always/finally" node in an Ansible workflow template?

I have an Ansible Automation Platform workflow template and I want to add a job to report the completion status of the template to a REST API, whether it fails or not--similar to the Finally section ...
jeremywat's user avatar
  • 111
0 votes
0 answers
33 views

get no debug on why my role is not triggered from my ansible playbook

I have a Vagrant infra to test ansible roles. Here is my playbook luis@spinoza:~/proj/g/infra/mz_devops/vagrant/deb11$ more tests/playbook_test_doc.yml --- - name: Debug role path content hosts: all ...
user3313834's user avatar
0 votes
0 answers
36 views
+100

Is there an ansible command to configure a vmware host to synchronize time with the host?

I've been searching the docs for a bit, but is there a way in ansible - either the rest api or the built-in api - for vcenter to configure a host that has vmware tools installed to synchronize its ...
Peter Turner's user avatar
  • 1,376
0 votes
1 answer
1k views

Is there a way to declare global(?) variables inside an ansible task?

I have an Ansible playbook, this playbook has a role on it, this role is configured to run only on 2 hosts: yaml - hosts: node1,orchestrator1 gather_facts: True any_errors_fatal: True ...
k.Cyborg's user avatar
  • 165
0 votes
1 answer
107 views

Ansible Connecting to remote Docker container over SSH

I have the following situation: I have a remote server that runs docker with a Postgres container. The Postgres instance is only reachable through a docker network, not directly from the remote server....
Tiim's user avatar
  • 11
0 votes
0 answers
52 views

Identifying worker nodes from Ansible inventory group which are not yet joined to k8s cluster using ansible.builtin.regex_search and regex_replace

I am using Ansible to configure a k8s cluster with several nodes. I have a playbook which checks if a variable representing the kubeadm join command has already been defined. If it has not, it ...
Jehan Alvani's user avatar
0 votes
1 answer
41 views

How can I log every command for which an Ansible playbook uses elevated permissions?

I have an Ansible playbook that runs against a Linux target host and uses become to gain elevated permissions for those actions that require it. For auditing purposes, I need a list of all the Unix ...
jstarek's user avatar
  • 123
0 votes
1 answer
796 views

how to run powershell script as windows administrator user using ansible

i want to run a power shell script on remote windows machine. The PowerShell script will install software on C drive. The user which used to login is already in administrator group. But when the ...
heyloitsmeraj's user avatar
1 vote
1 answer
39 views

Why doesn't ansible.builtin.lineinfile behave as expected in this particular task?

I'm attempting to update /boot/firmware/cmdline.txt on a few Raspberry Pis to enable cgroup support. Seemed a good fit for ansible.builtin.lineinfile. The existing contents of /boot/firmware/cmdline....
Jehan Alvani's user avatar
0 votes
2 answers
354 views

why does my Ansible playbook throw "Found existing installation: requests 2.25.1\n\n:stderr:ERROR: Cannot uninstall requests 2.25.1"?

I'm trying to run an ansible playbook that installs docker and docker-compose and runs a compose file on a ec2 t2.micro. To use the docker modules in ansible, I need to have docker and docker-compose ...
Keshav Singh N's user avatar
0 votes
1 answer
183 views

Unable to create a project with MANUAL as source in AWX

I have followed the instructions to install AWX from this site. https://computingforgeeks.com/install-and-configure-ansible-awx-on-centos/ But I'm unable to create manual SCM project on new project on ...
Siva's user avatar
  • 223
1 vote
1 answer
37 views

ansible_become has no effect despite the ability to execute sudo on GCP hosts

Say I want to execute the following command on target hosts (deployed on GCP): ansible all -a "head -1 /etc/shadow". The command demands the root access. With the default Ansible ...
SkogensKonung's user avatar
0 votes
1 answer
143 views

Run dependencies only once in muliple plays in Ansible

I have a collection of roles that all depend on a common role: # roleA/meta/main.yaml dependencies: - role: common # roleB/meta/main.yaml dependencies: - role: common # roleC/meta/main.yaml ...
FuriousGeorge's user avatar
2 votes
2 answers
102 views

Use an asymmetric cypher to secure Ansible vault

I'm trying to develop a Playbook which must handle sensitive user data (SSH keys, Registry credentials, etc.). Only a user and the Ansible controller can see the data associated with that same user. ...
Adrien H's user avatar
  • 121
1 vote
1 answer
391 views

Ansible role depend on other roles

I have a role, foo that installs a file {{ foo_path }} that's defined in roles/defaults/main.yml. I have a second role, bar that depends on that file being there. I could put foo in the roles/meta/...
FuriousGeorge's user avatar
0 votes
0 answers
233 views

Update apt cache from ansible when user is different from root

I have the following Dockerfile I'm using to test my ansible playbook. FROM ubuntu ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install -y git software-properties-common ansible ...
Gianluca's user avatar
  • 101
1 vote
1 answer
141 views

Use ansible to create GitHub repository with README

We use Ansible to automatically setup Kubernetes clusters. KPT https://kpt.dev/ is further used to deploy config files to pods in these clusters. In this process we need to create new GitHub ...
r3volutionxxx's user avatar
0 votes
0 answers
53 views

Is there a way to include a role once?

Suppose there is a relatively basic role that is a prerequisite for other roles, but not basic enough to be just included everywhere. The dependent roles could use ansible.builtin.include_rule, but ...
Helmut Grohne's user avatar
1 vote
1 answer
227 views

Using a different Python version in AWX

I updated a recent playbook module that says I need to use at least Python version 3.8. I run this playbook on our AWX controller. When I run the cmd module and do a "which python3" I get ...
David Desjardins's user avatar
1 vote
1 answer
1k views

Why is Ansible task getting stuck for so long?

I'm new to Ansible, I've made a playbook with only two tasks as shown below: - name: Installing Kubernetes for the master node connection: ssh hosts: x.x.x.x become_method: su tasks: - ...
Muhammed Adil's user avatar
0 votes
0 answers
40 views

How to manage ports using proxycommand and ansible

Sometimes when I'm using ansible against a fairly large number of hosts (around 100) about 3-5 of them jump to a completely different host. These devices are all connected via proxycommand using ...
Peter Turner's user avatar
  • 1,376
0 votes
1 answer
377 views

How to define rollback or rescue in ansible folder structure?

I would like to define rescue or rollback executions within my Ansible structure. I am using this recommended structure: roles rolename files tasks templates handlers ... I know ...
Vietna's user avatar
  • 25
0 votes
0 answers
95 views

ansible action plugin execute some modules once

I stumbled across following problem creating custom python ansbile action plugin: how to execute some modules once (i know in yaml it is possible to set run_once and delegate_to)? For example having ...
Tautvis's user avatar
0 votes
0 answers
322 views

Unable to install Jenkins plugin via ansible

I've been trying to use ansible to install Jenkins and then once Jenkins has been installed, use the jenkins_plugin module to install the build-pipeline-plugin into it. Here's my code (also hosted on ...
AjB's user avatar
  • 103
0 votes
1 answer
637 views

Multiple shell commands not executing with shell module

For some reason this fails: - name: "Get GPG key from the Jenkins portal" get_url: url: https://pkg.jenkins.io/debian-stable/jenkins.io.key dest: /usr/share/keyrings/jenkins.io.key ...
AjB's user avatar
  • 103
0 votes
1 answer
683 views

How to Control Ansible Loop or Task Default Output

I am trying to get my playbook to print readable debug output for stat on a number of directories when executing. The below shows the with_items and loop way and both work but the real problem is the ...
chipfall's user avatar
  • 111
2 votes
1 answer
482 views

Should I turn off copilot for text files containing secrets?

I use VSCode and have recently started using GitHub Copilot for my projects (programming and devops related). I understand that Copilot will send parts of my text to a remote server to get suggestions ...
cherouvim's user avatar
  • 121
1 vote
1 answer
241 views

Why is ansible loop adding square brackets ("[]") into my role?

I'm writing a role where I need to iterate over a list using the loop option. I'm using the ZFS module aisbergg.zfs. The role: - hosts: localhost vars: zfs_pool_name: tank ...
k.Cyborg's user avatar
  • 165
0 votes
0 answers
33 views

Ansible Tower / AWX - Job Execution when Instance Fails / becomes unavailable

I have queries on the Ansible Tower/ AWX job execution. While a playbook is under execution. Let's assume this is a lengthy list of tasks and below are the two scenario. This is more on towards ...
Koushik Padmanaban's user avatar
0 votes
1 answer
56 views

Where does Ansible DSL get translated to either Powershell or Python?

When running Ansible scripts, where does the translation from Ansible DSL to Python(Linux) or Powershell(Windows) happen? I assume this is on the Ansible node, that is, where the Ansible command is ...
Chris F's user avatar
  • 384
0 votes
1 answer
148 views

How to verify the time zone change is correct on AWS EC2 using Ansible?

We can use the following code to set a new timezone on AWS EC2 using Ansible. --- - hosts: linuxservers proxmoxservers remote_user: ansible become: yes tasks: - name: 'Set timezone to Buenos ...
Biju's user avatar
  • 255
1 vote
1 answer
1k views

Ansible Unsupported Parameters for using handler

I'm trying to run a ansible task but I keep getting an error. This is the play I want to run: - name: use of handlers hosts: all tasks: - name: install packages yum: name: httpd ...
Sandy's user avatar
  • 11
0 votes
0 answers
341 views

ansible win_copy cannot copy src file as it does not exist

I am trying to run a molecule test where it is supposed to create a VM and copy a binary from network UNC path to the VM but somehow it is failing with the below mentioned error. This is what the task ...
WindowsGuy's user avatar
2 votes
1 answer
5k views

Ansible: How to get hostname without domain name?

How to get value from /etc/hostname ignoring domain name. For example, /etc/hostname says "client.test.dom" and I need to get "client". I have tried "{{ ansible_nodename | ...
Виктор Гринько's user avatar
2 votes
1 answer
335 views

How to lock a user using ansible?

Given a username, if that user exists, lock it, otherwise keep it missing. The most likely module is ansible.builtin.user. There passing password: "*" and shell: "/usr/sbin/nologin"...
Helmut Grohne's user avatar
2 votes
1 answer
945 views

How to create, but not overwrite, a file and manage its permissions with ansible?

The task seems simple. If the file does not exist, create it, otherwise retain the file and its content. In both cases, apply permissions (owner, group, mode). The most obvious candidate to this task ...
Helmut Grohne's user avatar
1 vote
1 answer
64 views

Unable to login as `ubuntu` user on ec2 instance spawned from auto scaling group

Utilizing Ansible AWS modules, I'm creating an AMI from an existing EC2 instance where I am able to ssh with both my user and default account (ubuntu). After the AMI is in a ready state, I then create ...
Chris's user avatar
  • 11
1 vote
2 answers
233 views

Is there a way to exclusively manage multiple ssh keys with differing per-key options using ansible?

Ansible provides a ansible.builtin.authorized_key module which provides a lot of functionality: You can set exclusive: true to delete all other keys. You can set key_options: .... You can list ...
Helmut Grohne's user avatar
1 vote
4 answers
223 views

What is a good strategy to prevent Ansible playbook runs against the wrong hosts? [duplicate]

It is too easy to run playbooks on the wrong hosts in Ansible I know the best practice would be to use --limit to make sure you can not select the wrong host. I do not trust --limit to ensure Ansible ...
timfox123's user avatar
1 vote
1 answer
563 views

Ansible - Configuring Supermicro servers via Redfish API

I plan to configure Supermicro servers via the Redfish API. Ansible provides the following modules for the Redfish API: community.general.redfish_command community.general.redfish_config Supermicro ...
stackprotector's user avatar
0 votes
1 answer
6k views

Ansible jinja2 if/elif/else construct not working anymore

I am using a jinja2 template for creating several files. Those differ a bit dependent on a set variable. Here's the code: {% if production_env == "prod" or "stage" %} password: &...
diggnsaegg's user avatar
1 vote
0 answers
30 views

Implementing the right conditions for a yum command for centos5 in Ansible

I'm currently working with a centos5 host and I have to install some packages with yum. Unfortunately, as far as I know, centos5 doesn't support Ansible's yum module, since it requires python2 ...
Wander's user avatar
  • 11
0 votes
1 answer
1k views

ansible fatal: "sudo: a password is required", even after priveleges are escalated

while trying to setup a remote machine using ansible, I am running into the following issue: FAILED! => {"changed": false, "module_stderr": "sudo: a password is required\n&...
vinylic's user avatar
1 vote
1 answer
70 views

Creating a hostgroup from a super-set of hosts

I have two host files with different hosts, hostGroups and super-set in each file like below. /ets/hostFiles/TestBoxes [TestBox:children] groupA groupB [groupA] ... ... [groupB] ... ... /ets/...
Siva's user avatar
  • 223
0 votes
1 answer
1k views

Ansible / Jinja2 Unexpected templating type error

I am trying to take a dictionary from one or more async tasks "register: task_variable" then collecting it as a list based on its id's and running a wait task using async_status on the ...
Cyber Axe's user avatar

1
2 3 4 5
9