Questions tagged [ansible-1.x]
7 questions
5
votes
1 answer
copy file and run a particular command using ansible?
I need to copy one file into lot of servers and then after copying execute a particular command. Below are the steps I need to do for each machine.
copy file into a server.
execute a command (sudo restart tree) after copying.
sleep for few…

john
- 11,311
- 40
- 131
- 251
5
votes
1 answer
Ansible : Using regular expression in the module "copy"
The context
I'm trying to build a continuous-integration platform and in a Ansible playbook I use the maven-dependency-plugin:get to download an artifact from a Nexus on the master which will be deployed on a remote server using the Ansible module…

Radouane ROUFID
- 10,595
- 9
- 42
- 80
4
votes
2 answers
execute a command by switching to root user in ansible
I am working on Ansible playbook to execute some of my tasks. In one of my tasks, I need to switch to particular directory and then execute a command using sudo but I need to do all these things by switching to root user first otherwise it won't…

john
- 11,311
- 40
- 131
- 251
3
votes
0 answers
include task file conditional - tasks still trying to run?
NB: I am using Ansible 1.9.4 and can't upgrade at this time
I am trying to conditionally include a task file based on whether or not a nested dictionary exists.
I have 4 hosts, 1 of which has a type of virtual machine I'm calling heavy_nvme but the…

turbonerd
- 1,234
- 4
- 27
- 63
1
vote
1 answer
Ansible unexpected eval of variables when using flattened
Have have a configuration file looking like that:
one:
some: 'conf'
foo:
-
bar:
- 'one'
- 'two'
- 'three'
-
bar:
- 'one'
- 'four'
- 'five'
I want to get a list containing all strings of bar lists.…

Gui-Don
- 1,366
- 11
- 25
0
votes
1 answer
Ansible error- unable to connect, check login credentials (login_user, and login_password, which can be defined in ~/.my.cnf)
I am new to ansible i want to execute my command like this
zcat /usr/share/doc/zabbix-server-mysql-3.0.9/create.sql.gz| mysql -u zabbix -p zabbixdb
Ansible_code:
- name: Import the initial schema
mysql_db:
state: import
…

user6826691
- 1,813
- 9
- 37
- 74
0
votes
1 answer
How do I list hosts using Ansible 1.x API
Ansible-playbook has a --list-hosts cli switch that just outputs the hosts affected by each play in a playbook. I am looking for a way to access to same information through the python API.
The (very) basic script I am using to test right now…

Jason Donahue
- 1
- 1