Re: [ansible-project] Unable to negotiate with 10.192.1.5 port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

2019-03-21 Thread Dick Visser
On Fri, 22 Mar 2019 at 03:30, Jonathan Lozada De La Matta
 wrote:
>
> you probably need to do this on your ~/.ssh/config
>
> Host 192.168.1.1 #the IP of the device
>   KexAlgorithms +diffie-hellman-group1-sha1


Alternatively, you can configure it in your ansible inventory:

10.192.21.5 
ansible_ssh_common_args='-oKexAlgorithms=+diffie-hellman-group1-sha1'



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwN-tBfGFHC-M6o1%3DYarF8pyQJ9gYhrtZDqSVF-1MMgNnQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] user_module and ssh key

2019-03-21 Thread Alexander B.
Hello. 
There are two hosts. On first I create a user and generate SSH keys. Now I 
need to transfer private key to second host to connect using it to first 
host without creating a user on second. I haven't found an output of 
parameter ssh_key as analogg to ssh_public_key in module user. In other 
modules related to SSH there is only a possibility to see contents of 
public key. What is the reason for this restriction?

The documentation 
 is 
written about the path to the ssh public key. in the example of a private 
key.

ssh_key_file  Path to generated SSH public key file. *Sample*: 
/home/asmith/.ssh/id_rsa

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/97cdbda3-03a5-438d-9fe2-cde60551a5c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Do I need to use wait_for and/or handler to install software from a playbook?

2019-03-21 Thread Kai Stian Olstad
On 21.03.2019 01:41, gigit1...@gmail.com wrote:
> 
> 
> Hello,
> I understand that tasks in a playbook run top down but I don't know if they
> wait for each other.

They do.


> I have a question about how you control multiple
> package installs in a way so that subsequent tasks (that install software)
> will not run until the previous software installation is finished.

Default in Ansible the first task is run on all hosts, when that task in 
finished on all host. Ansible will start to run the second task on all host and 
so on.


> I’m
> using a combination of yum module and command module to do the software
> installs:

Please don't do that, just use the yum module.


> tasks:
> 
>- name: First run yum update -y with yum module
> 
>  yum:
> 
>name: "*"
> 
>state: latest
> 
>- name: Only After yum update is done install python3 with a specific 
> command
> 
>command: sudo yum -y install python3 python3-pip

I highly recommend using yum instead

  - name: Install python3 and pip3
yum:
  - python3
  - python3-pip


> 
>- name: Only After python is installed install the latest version of
> Apache with yum module
> 
>yum:
> 
>  name: httpd
> 
>  state: latest
> 
> Will this work as is or do I need to add “wait_for” or use a "handler" to
> make sure that one install is completed before the next one is started?

No wait is required, since Ansible run the task in order and finishes a task on 
all server before it goes to the next task.


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/50f397a7-4eda-82aa-f99a-e8242b5f24a2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Unable to negotiate with 10.192.1.5 port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

2019-03-21 Thread Jonathan Lozada De La Matta
you probably need to do this on your ~/.ssh/config

Host 192.168.1.1 #the IP of the device
  KexAlgorithms +diffie-hellman-group1-sha1


On Thu, Mar 21, 2019 at 10:08 PM Hitesh Kumar 
wrote:

> I am trying to connect switches in my network using ansible play book, but
> not able to connect it to my network switches
>
> When I am running a command:
> hiteshkumar@INPNBXXX:/mnt/c/Users/hitesh.kumar$ sudo ansible-playbook
> getarp.yml -u admin.kumar -k
> SSH password:
>
> PLAY [Get ARP information]
> *
> TASK [show arp]
> fatal:
> [10.128.11.2]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect
> to the host via ssh: ssh: connect to host 10.128.11.2 port 22: Connection
> refused", "unreachable": true}
> fatal: [10.192.21.5]: UNREACHABLE! => {"changed": false, "msg": "Failed to
> connect to the host via ssh: ssh: connect to host 10.192.21.5 port 22:
> Connection refused", "unreachable": true}
>
> Direct SSH from bash prompt
> root@INPNB0:# ssh 10.128.7.2
> Unable to negotiate with 10.128.7.2 port 22: no matching cipher found.
> Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
> root@INPNB05272:#
>
> Logs at switch side
> 300395: Mar 20 09:25:44.175 UTC: %SSH-3-NO_MATCH: No matching cipher
> found: client chacha20-poly1...@openssh.com
> ,aes128-ctr,aes192-ctr,aes256-ctr,aes128-...@openssh.com,
> aes256-...@openssh.com server aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c7dffeda-7e72-42e6-a953-cf15d52770a0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan lozada de la matta

AUTOMATION PRACTICE

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BKuhgyCpOk%3DZaJ%3DgbG8i1xBUpbHtB61ccMsAQOzEoJN1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Unable to negotiate with 10.192.1.5 port 22: no matching cipher found. Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

2019-03-21 Thread Hitesh Kumar


I am trying to connect switches in my network using ansible play book, but 
not able to connect it to my network switches

When I am running a command:
hiteshkumar@INPNBXXX:/mnt/c/Users/hitesh.kumar$ sudo ansible-playbook 
getarp.yml -u admin.kumar -k
SSH password:

PLAY [Get ARP information] 
*
TASK [show arp] 
fatal:
 
[10.128.11.2]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect 
to the host via ssh: ssh: connect to host 10.128.11.2 port 22: Connection 
refused", "unreachable": true}
fatal: [10.192.21.5]: UNREACHABLE! => {"changed": false, "msg": "Failed to 
connect to the host via ssh: ssh: connect to host 10.192.21.5 port 22: 
Connection refused", "unreachable": true}

Direct SSH from bash prompt
root@INPNB0:# ssh 10.128.7.2
Unable to negotiate with 10.128.7.2 port 22: no matching cipher found. 
Their offer: aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc
root@INPNB05272:#

Logs at switch side
300395: Mar 20 09:25:44.175 UTC: %SSH-3-NO_MATCH: No matching cipher found: 
client chacha20-poly1...@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,
aes128-...@openssh.com,aes256-...@openssh.com server 
aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c7dffeda-7e72-42e6-a953-cf15d52770a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible Yum module has no return values?

2019-03-21 Thread Jonathan Lozada De La Matta
have rou ansible with verbose? it will tell you when they get installed.

On Thu, Mar 21, 2019 at 9:36 PM  wrote:

> Hello,
>
> Since the Yum module has no return values, how do you know when the
> package it installed is finished installing? How would you know when to
> start a new task that depends on the package being installed?
>
> Thank You
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7182cdb5-765d-4a7f-b3fb-60e20dec5ff1%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Jonathan lozada de la matta

AUTOMATION PRACTICE

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BK2P%2BhAjaEmqDwUk%3DdEwEkK9bieMSxCXNwMBMUE_ehkjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Yum module has no return values?

2019-03-21 Thread gigit1000


Hello,

Since the Yum module has no return values, how do you know when the package 
it installed is finished installing? How would you know when to start a new 
task that depends on the package being installed?

Thank You 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7182cdb5-765d-4a7f-b3fb-60e20dec5ff1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to say “When” something is finished installing?

2019-03-21 Thread gigit1000
The following playbook worked for me, but I just started with Ansible and 
I'm wondering if I went about this wrong? I feel like I may have missed an 
easier way to say: do something only after a package has finished 
installing ... 
tasks: - name: Install python3 with a specific command and register stdout 
to a var command: sudo yum -y install python3 python3-pip register: varname 
- name: Create a directory only after python3 has been installed file: 
path: /home/ec2-user/newdirectory state: directory when: 
varname.stdout.find("Complete!") != -1 


 







On Thursday, March 21, 2019 at 2:24:58 PM UTC-7, gigi...@gmail.com wrote:
>
> Hello,
>
> I have two tasks in a playbook. The first task installs software with the 
> command module. The second creates a file. I don’t want the second task to 
> run until the software has finished installing. I’m pretty sure I need to 
> use “when”, but I’m not sure what to evaluate to determine that the 
> software has finished installing.
>
> I’m thinking that I could use the stdout of this yum command? The last 
> line output to the screen is “Complete!” would it be possible to base the 
> “when” on the existence of that text string in stdout?
> something like:
>
> - name: Install python3 with a specific command and register stdout to a 
> var
>   command: sudo yum -y install python3 python3-pip
>   register: stdout 
>
> - name: Create a directory after python3 has been installed 
>
> file:
>
>   path: /home/newdirectory
>
>   state: directory
>
>   when: [a line of text in stdout] == "Complete!"
>
>  
> Does this logic even make sense? I assumed that "register" would put all 
> of stdout into an array of lines of strings, but I don't if that's how it 
> works or not or how to search stdout for the string "Complete!"? 
>
> Thanks much for any help 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cdc8e599-deb7-4c7c-b94f-a2494feef196%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Need help with how to grab public ip and use it for later part in playbook

2019-03-21 Thread tinkuchowdary32
Thank you sebastian for quick reply 
unfortunately that didn't work

here the part that i am running

  - name: "gather instance facts"
ec2_instance_facts:
  instance_ids: i-xx
  region: "{{ region }}"
delegate_to: localhost
when: ec2_instance_prov == 'no'
register: ec2
tags:
  - gather-facts
  - provision-ec2
  - debug: 
  var: ec2.instances.0.public_ip_address 
tags:
  - gather-facts

after i run this i see no output

PLAY [Provision an EC2 Instance] 
*

TASK [gather instance facts] 
*
ok: [localhost -> localhost]

TASK [debug] 
*
ok: [localhost] => {
"ec2.instances.0.public_ip_address": "VARIABLE IS NOT DEFINED!"
}

PLAY RECAP 
***
localhost  : ok=2changed=0unreachable=0
failed=0   


On Thursday, March 21, 2019 at 2:48:03 PM UTC-7, tinkuch...@gmail.com wrote:
>
> here is the dubug output ec2-facts
>
> "ec2": {
> "changed": false, 
> "failed": false, 
> "instances": [
> {
> "ami_launch_index": 0, 
> "architecture": "x86_64", 
> "block_device_mappings": [
> {
> "device_name": "/dev/xvda", 
> "ebs": {
> "attach_time": "2019-03-21T18:28:03+00:00", 
> "delete_on_termination": true, 
> "status": "attached", 
> "volume_id": "vol-"
> }
> }
> ], 
> "client_token": "", 
> "cpu_options": {
> "core_count": 1, 
> "threads_per_core": 1
> }, 
> "ebs_optimized": false, 
> "ena_support": true, 
> "hibernation_options": {
> "configured": false
> }, 
> "hypervisor": "xen", 
> "image_id": "ami-", 
> "instance_id": "i-xxx", 
> "instance_type": "t2.micro", 
> "key_name": "x", 
> "launch_time": "2019-03-21T18:28:03+00:00", 
> "monitoring": {
> "state": "disabled"
> }, 
> "network_interfaces": [
> {
> "association": {
> "ip_owner_id": "amazon", 
> "public_dns_name": "
> ec2-x.us-east-2.compute.amazonaws.com", 
> "public_ip": "xx.xx.xx.51"
> }, 
> "attachment": {
> "attach_time": "2019-03-21T18:28:03+00:00", 
> "attachment_id": "eni-attach-xx", 
> "delete_on_termination": true, 
> "device_index": 0, 
> "status": "attached"
> }, 
> "description": "", 
> "groups": [
> {
> "group_id": "sg-xx", 
> "group_name": "xx"
> }
> ], 
> "ipv6_addresses": [], 
> "mac_address": "xx:66:xx:77:d4:f4", 
> "network_interface_id": "eni-xxx", 
> "owner_id": "xx", 
> "private_dns_name": 
> "ip-xxx8.us-east-2.compute.internal", 
> "private_ip_address": "1xx", 
> "private_ip_addresses": [
> {
> "association": {
> "ip_owner_id": "amazon", 
> "public_dns_name": "
> ec2-xx-xxx-xxx-xx.us-east-2.compute.amazonaws.com", 
> "public_ip": "18.x.xx.xx
> }, 
>

Re: [ansible-project] Need help with how to grab public ip and use it for later part in playbook

2019-03-21 Thread Sebastian Meyer
On 21.03.19 22:48, tinkuchowdar...@gmail.com wrote:> here is the dubug
output ec2-facts
>
> "ec2": {
> "changed": false,
> "failed": false,
> "instances": [
> {
> "ami_launch_index": 0,
> "architecture": "x86_64",
[..]
> "product_codes": [],
> "public_dns_name":
> "xxx.us-east-2.compute.amazonaws.com",
> "public_ip_address": "xx.xxx.44.51",
> "root_device_name": "/dev/xvda",
[...]
> }
> ]
> }
> }
>
>
> i want to use debug option in playbook  to print only the public ip
>
> ec2.instances.public_ip is not working
instances is an array of dicts here.

You'll need a 0 in there to access the first element of that list:

ec2.instances.0.public_ip_address

- Sebastian

-- 
Sebastian Meyer
Linux Consultant & Trainer

Mail: me...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/57e822cd-63ff-777b-4f0c-11b3f8169eeb%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Need help with how to grab public ip and use it for later part in playbook

2019-03-21 Thread tinkuchowdary32
here is the dubug output ec2-facts

"ec2": {
"changed": false, 
"failed": false, 
"instances": [
{
"ami_launch_index": 0, 
"architecture": "x86_64", 
"block_device_mappings": [
{
"device_name": "/dev/xvda", 
"ebs": {
"attach_time": "2019-03-21T18:28:03+00:00", 
"delete_on_termination": true, 
"status": "attached", 
"volume_id": "vol-"
}
}
], 
"client_token": "", 
"cpu_options": {
"core_count": 1, 
"threads_per_core": 1
}, 
"ebs_optimized": false, 
"ena_support": true, 
"hibernation_options": {
"configured": false
}, 
"hypervisor": "xen", 
"image_id": "ami-", 
"instance_id": "i-xxx", 
"instance_type": "t2.micro", 
"key_name": "x", 
"launch_time": "2019-03-21T18:28:03+00:00", 
"monitoring": {
"state": "disabled"
}, 
"network_interfaces": [
{
"association": {
"ip_owner_id": "amazon", 
"public_dns_name": 
"ec2-x.us-east-2.compute.amazonaws.com", 
"public_ip": "xx.xx.xx.51"
}, 
"attachment": {
"attach_time": "2019-03-21T18:28:03+00:00", 
"attachment_id": "eni-attach-xx", 
"delete_on_termination": true, 
"device_index": 0, 
"status": "attached"
}, 
"description": "", 
"groups": [
{
"group_id": "sg-xx", 
"group_name": "xx"
}
], 
"ipv6_addresses": [], 
"mac_address": "xx:66:xx:77:d4:f4", 
"network_interface_id": "eni-xxx", 
"owner_id": "xx", 
"private_dns_name": 
"ip-xxx8.us-east-2.compute.internal", 
"private_ip_address": "1xx", 
"private_ip_addresses": [
{
"association": {
"ip_owner_id": "amazon", 
"public_dns_name": 
"ec2-xx-xxx-xxx-xx.us-east-2.compute.amazonaws.com", 
"public_ip": "18.x.xx.xx
}, 
"primary": true, 
"private_dns_name": 
"xx.us-east-2.compute.internal", 
"private_ip_address": "xx"
}
], 
"source_dest_check": true, 
"status": "in-use", 
"subnet_id": "subnet-", 
"vpc_id": "vpc-x"
}
], 
"placement": {
"availability_zone": "us-east-2c", 
"group_name": "", 
"tenancy": "default"
}, 
"private_dns_name": "xxx.us-east-2.compute.internal", 
"private_ip_address": "xxx.xx.xx.xx", 
"product_codes": [], 
"public_dns_name": 
"xxx.us-east-2.compute.amazonaws.com", 
"public_ip_address": "xx.xxx.44.51", 
"root_device_name": "/dev/xvda", 
"root_device_type": "ebs", 
"security_groups": [
{
"group_id": "sg-", 
"group_name": "xx"
}
], 
"source_dest_check": true, 
"state": {
"code": 64, 
"name": "stopping"
}, 
"state_reason": {
"code": "Client.UserInitiatedShutdown", 
"message": "Client.UserInitiatedShutdown: User 
initiated shutdown"
}, 
"state_transition_reason": "User initiated (2019-03-21 
19:33:16 GMT)", 
"subnet_id": "subnet-xxx", 
"virtualization_type": "hvm", 
"vpc_id": "vpc-"
}

[ansible-project] How to say “When” something is finished installing?

2019-03-21 Thread gigit1000


Hello,

I have two tasks in a playbook. The first task installs software with the 
command module. The second creates a file. I don’t want the second task to 
run until the software has finished installing. I’m pretty sure I need to 
use “when”, but I’m not sure what to evaluate to determine that the 
software has finished installing.

I’m thinking that I could use the stdout of this yum command? The last line 
output to the screen is “Complete!” would it be possible to base the “when” 
on the existence of that text string in stdout?
something like:

- name: Install python3 with a specific command and register stdout to a var
  command: sudo yum -y install python3 python3-pip
  register: stdout 

- name: Create a directory after python3 has been installed 

file:

  path: /home/newdirectory

  state: directory

  when: [a line of text in stdout] == "Complete!"

 
Does this logic even make sense? I assumed that "register" would put all of 
stdout into an array of lines of strings, but I don't if that's how it 
works or not or how to search stdout for the string "Complete!"? 

Thanks much for any help 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e1d925ea-f04e-403f-8159-1fb92e536291%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Building variables like in Jekyll?

2019-03-21 Thread Jon Spriggs
Hi,

I've a complex data structure to build, which, while I can do it in
group/host_vars/ I'm worrying about the people who follow me on, and how
they'll cope with it.

I've some experience of Jekyll, which has a good data structure with yml
files in a directory, and I'd like, if possible to use that with Ansible.
In that system, there is a "data" directory, and each directory under that
path is loaded as a dict with the same name as the directory, and then each
file under that is loaded as either a variable or a dict again (depending
on the content).

So, for example, if I had this structure:

data / dir1 / file1.yml
data / dir2 / dir3 / file2.yml
data / dir2 / dir3 / file3.json
data / file4.yml

I would have these variables loaded:
{
  "data": {
"dir1": {
  "file1": {{ content_of_file1.yml }}
},
"dir2": {
  "dir3": {
"file2": {{ content_of_file2.yml }},
'file3': {{ content_of_file3.json }}
  }
},
'file4': {{ content_of_file4.yml" }}
  }
}

Short of writing a lookup or a playbook to load the data like this, are
there any modules or plugins I can use already, or import from another
project?

Thanks!
--
Jon "The Nice Guy" Spriggs
@jontheniceguy everywhere...
https://jon.sprig.gs

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOrCWesYmfzktgkrwmS3gbjk5LLxnxiU0_Dj5E%2BBeCo4yTigsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] create virtualenv with pip modle and centos scl (rh-python36)

2019-03-21 Thread Matt Martz
I believe the problem is that the system python at /usr/bin/python doesn't
have python-setuptools installed

You would need to either install python-setuptools via yum, or set
`ansible_python_interpreter` to `/opt/rh/rh-python36/root/bin/python` so
that ansible is using that SCL python also.

By default ansible will use /usr/bin/python on the remote, and use that to
configure the virtualenv, but configure the virtualenv to use the SCL
python.  So basically ansible is using 1 python to run another.

On Thu, Mar 21, 2019 at 3:40 PM 'Peter Hudec' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Hi all,
>
> I’m trying to solve following problem.
>
> I need to create virtualenv for python using centos scl rh-python36
>
> Manual way is easy, there are several way how to do that
>
> /opt/rh/rh-python36/root/bin/python -m venv env
> . ./env/bin/activate
> pip install -U pip setuptools
> pip install -t requirements.txt
>
> But but with ansible I’m a little bit lost.
>
>   - name: create virtualenv
> pip:
>   virtualenv: "{{ haproxy_tools_remote_dir }}/{{ haproxy_tools_version
> }}/env"
>   virtualenv_python: "/opt/rh/{{ haproxy_tools_scl_python
> }}/root/bin/python"
>   requirements: "{{ haproxy_tools_remote_dir }}/{{
> haproxy_tools_version }}/requirements.txt"
> tags:
>   - debug
>
> The output is
> fatal: [lb01.test.host.sk]: FAILED! => {"changed": false, "msg": "No
> setuptools found in remote host, please install it first.”}
>
> Any idea, please ?
>
> regards
> Peter
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/E255A9C5-493C-4EC1-8C79-71E55F69404F%40home.hudecof.net
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9w%3DiJ6Tzf7rrhUa%2BLRcoyqdktts%2B-A5pVjFwh7%2BiGhpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread Kai Stian Olstad
On 21.03.2019 20:51, John Harmon wrote:
> 
> Thx all.  Those helped.  I now get it to replace, but it replaces my string
> and not just my backref.   Not sure what I am doing wrong.  I think that is
> just the default behavior of replace.  Can't use quantifiers with negative
> look aheads/behinds.

It will be easier to help if you could show what do have in the file and what 
is should be after replace.


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5b130f54-6447-e962-4fd8-851bb35b01a8%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] create virtualenv with pip modle and centos scl (rh-python36)

2019-03-21 Thread 'Peter Hudec' via Ansible Project
Hi all,

I’m trying to solve following problem.

I need to create virtualenv for python using centos scl rh-python36

Manual way is easy, there are several way how to do that

/opt/rh/rh-python36/root/bin/python -m venv env
. ./env/bin/activate
pip install -U pip setuptools
pip install -t requirements.txt

But but with ansible I’m a little bit lost.

  - name: create virtualenv
pip:
  virtualenv: "{{ haproxy_tools_remote_dir }}/{{ haproxy_tools_version 
}}/env"
  virtualenv_python: "/opt/rh/{{ haproxy_tools_scl_python 
}}/root/bin/python"
  requirements: "{{ haproxy_tools_remote_dir }}/{{ haproxy_tools_version 
}}/requirements.txt"
tags:
  - debug

The output is
fatal: [lb01.test.host.sk]: FAILED! => {"changed": false, "msg": "No setuptools 
found in remote host, please install it first.”}

Any idea, please ?

regards
Peter

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/E255A9C5-493C-4EC1-8C79-71E55F69404F%40home.hudecof.net.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to change the security groups of an existing ec2 instance

2019-03-21 Thread Dick Visser
Hi

I have a task to ensure that an instance is available and configured.
But now I'd like make sure the instance has a few extra security
groups, but I can't find the correct syntax to get this working.

My task look like this:

- name: Ensure jumphost is available
  ec2_instance:
tags:
  Name: Jumphost
filters:
  tag:Name: Jumphost
  private-ip-address: 10.0.0.12
image_id: ami-blah12121
vpc_subnet_id: 1234
network:
  source_dest_check: false
  description: some_description
  private_ip_address: 10.0.0.12
security_groups:
  - public_ssh
  - nat_sg

The task runs OK without changes, but the instance does not get these
security groups added.
It just has the default security group.

I've tried a few things:

1. Use a list of group_id's of each security group (as opposed to the names)
2. Add those group names or group_ids to a list called 'groups' as
part of the 'network' parameter

But still no joy.
Any ideas how to configure the security groups of an instance with the
ec2_module?

thx

-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwN4Pwavqyok3CniLO-cX_Ypgi31v6md3D48e6wQFG%3DzNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread John Harmon


On Thursday, March 21, 2019 at 12:11:00 PM UTC-6, Kai Stian Olstad wrote:
>
> On 21.03.2019 18:10, John Harmon wrote: 
> > I have tried single quotes too around the regexp, but get a similar 
> issue 
> > 
> > TASK [dns_update : include_tasks] 
> > 
> 
>  
>
> > fatal: [ansible-ub18]: FAILED! => {"reason": "Syntax Error while loading 
> > YAML.\n  found unknown escape character\n\nThe error appears to have 
> been 
> > in '/etc/ansible/role/dns_update/tasks/Ubuntu18.yml': line 7, column 15, 
> > but may\nbe elsewhere in the file depending on the exact syntax 
> > problem.\n\nThe offending line appears to be:\n\nregexp: 
> > '.*nameservers.*$\\n.*addresses:(.*$)'\nreplace: \"\\1 {{ dns1 }}, 
> {{ 
> > dns 2}}\"\n  ^ here\nWe could be wrong, but this one looks 
> like 
> > it might be an issue with\nmissing quotes.  Always quote template 
> > expression brackets when they\nstart a value. For instance:\n\n 
> >   with_items:\n  - {{ foo }}\n\nShould be written as:\n\n 
> >   with_items:\n  - \"{{ foo }}\"\n"} 
> > 
>
> If you add this sed to correct the formatting somewhat 
>   ansible-playbook playbbok.yml | sed 's/\\n/\n/g' 
>
> you'll see that is pointing to your double quote in the replace line. 
>
>
> -- 
> Kai Stian Olstad 
>

Thx all.  Those helped.  I now get it to replace, but it replaces my string 
and not just my backref.   Not sure what I am doing wrong.  I think that is 
just the default behavior of replace.  Can't use quantifiers with negative 
look aheads/behinds. 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/26b38385-cc46-4646-9a9a-e3762a4e3b4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Importing user variables from multiple variable sources

2019-03-21 Thread Adam E
another alternative if you don't want to use an external plugin is to 
predefine your variable names and then combine them..

ie...

> users_global
>
users_group 

users_host (variable you set in host_vars)


and then use the "combine 
"
 
filter to combine them together . 
ie..

> users_global | combine(users_group, recursive=True) | combine(users_host, 
> recursive=True)



I agree though, I am also coming from puppet and miss hiera.   I may still 
consider going back to using it as there appears to be support 
 for it, 
but it would be nice to be fully integrated

The strategy I ended up going with for the similar problem you have is
1. I created a "users" hash in vars/ which contains all users that can be 
managed
2. then in my host & group_vars I populate a list such as 
"linux_users_global" or linux_users_unique_name which contains the list of 
users that should be managed either globally, group or at the host level
3. then in my playbook I merge all the variables that match the pattern 
"linux_users.*" . (see this link 
)
4. then I loop through that merged list and manage those users

for me, the above solution works quite well.


On Thursday, March 21, 2019 at 12:07:09 PM UTC-7, Suhail Choudhury wrote:
>
> Hi. 
>
> Thanks for reply Kai. 
>
> Default Ansible cannot solve this problem, which I find very odd as it 
> was a common issue that is very elegantly addressed in Pupept using 
> Hiera. 
>
> However a solution has been found! 
>
> Have a look at: 
>
>
> http://leapfrogonline.io/articles/2017-02-22-explicit-merging-of-ansible-variables/
>  
> https://github.com/leapfrogonline/ansible-merge-vars 
>
> They have solved exactly this issue and I'm testing their plugin and 
> so far so good. Certainly not as elegant as Puppet/Hiera but it's a 
> working solution. 
>
> Regards, 
> Suhail. 
>
> On Thu, 21 Mar 2019 at 18:49, Kai Stian Olstad 
> > wrote: 
> > 
> > On 21.03.2019 12:58, Suhail Choudhury wrote: 
> > > Thanks for your earlier reply Adam. 
> > > 
> > > So how can I combine variables for a list of "users" defined like so: 
> > > 
> > > *group_vars/all* 
> > > 
> > > users: 
> > >- name: alice 
> > >  comment: Alice 
> > > 
> > > *group_vars/group1* 
> > > 
> > > users: 
> > >- name: bob 
> > >  comment: Bob 
> > > 
> > > *host_vars/host1* 
> > > 
> > > users: 
> > >- name: charlie 
> > >  comment: Charlie 
> > > 
> > > How can all these variables be combined using "loop" or "with_items"? 
> > 
> > You can't, they will be overwritten in the order listed here 
> > 
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
>  
> > 
> > > What if there are duplicates? 
> > 
> > They are duplicates since all are call users and will be overwritten. 
> > 
> > 
> > > Can the "host_vars/host1" variables override and take precedence over 
> the 
> > > "group_vars/all" variables? 
> > 
> > It does. 
> > 
> > 
> > -- 
> > Kai Stian Olstad 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to ansible-proje...@googlegroups.com . 
> > To post to this group, send email to ansible...@googlegroups.com 
> . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/86213972-a12c-474a-0284-747eaa825cdd%40olstad.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b03d7f87-aef1-4d96-a1cd-77285441af13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Importing user variables from multiple variable sources

2019-03-21 Thread Suhail Choudhury
Hi.

Thanks for reply Kai.

Default Ansible cannot solve this problem, which I find very odd as it
was a common issue that is very elegantly addressed in Pupept using
Hiera.

However a solution has been found!

Have a look at:

http://leapfrogonline.io/articles/2017-02-22-explicit-merging-of-ansible-variables/
https://github.com/leapfrogonline/ansible-merge-vars

They have solved exactly this issue and I'm testing their plugin and
so far so good. Certainly not as elegant as Puppet/Hiera but it's a
working solution.

Regards,
Suhail.

On Thu, 21 Mar 2019 at 18:49, Kai Stian Olstad
 wrote:
>
> On 21.03.2019 12:58, Suhail Choudhury wrote:
> > Thanks for your earlier reply Adam.
> >
> > So how can I combine variables for a list of "users" defined like so:
> >
> > *group_vars/all*
> >
> > users:
> >- name: alice
> >  comment: Alice
> >
> > *group_vars/group1*
> >
> > users:
> >- name: bob
> >  comment: Bob
> >
> > *host_vars/host1*
> >
> > users:
> >- name: charlie
> >  comment: Charlie
> >
> > How can all these variables be combined using "loop" or "with_items"?
>
> You can't, they will be overwritten in the order listed here
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
>
> > What if there are duplicates?
>
> They are duplicates since all are call users and will be overwritten.
>
>
> > Can the "host_vars/host1" variables override and take precedence over the
> > "group_vars/all" variables?
>
> It does.
>
>
> --
> Kai Stian Olstad
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/86213972-a12c-474a-0284-747eaa825cdd%40olstad.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHdO4Gnd-ukbXE2KafyFsMtTF2hjYf32Onn%3DPa0Gcz9jV7adZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Importing user variables from multiple variable sources

2019-03-21 Thread Kai Stian Olstad
On 21.03.2019 12:58, Suhail Choudhury wrote:
> Thanks for your earlier reply Adam.
> 
> So how can I combine variables for a list of "users" defined like so:
> 
> *group_vars/all*
> 
> users:
>- name: alice
>  comment: Alice
> 
> *group_vars/group1*
> 
> users:
>- name: bob
>  comment: Bob
> 
> *host_vars/host1*
> 
> users:
>- name: charlie
>  comment: Charlie
> 
> How can all these variables be combined using "loop" or "with_items"?

You can't, they will be overwritten in the order listed here
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable

> What if there are duplicates?

They are duplicates since all are call users and will be overwritten.


> Can the "host_vars/host1" variables override and take precedence over the
> "group_vars/all" variables?

It does.


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/86213972-a12c-474a-0284-747eaa825cdd%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread Kai Stian Olstad
On 21.03.2019 18:10, John Harmon wrote:
> I have tried single quotes too around the regexp, but get a similar issue
> 
> TASK [dns_update : include_tasks]
> 
> fatal: [ansible-ub18]: FAILED! => {"reason": "Syntax Error while loading
> YAML.\n  found unknown escape character\n\nThe error appears to have been
> in '/etc/ansible/role/dns_update/tasks/Ubuntu18.yml': line 7, column 15,
> but may\nbe elsewhere in the file depending on the exact syntax
> problem.\n\nThe offending line appears to be:\n\nregexp:
> '.*nameservers.*$\\n.*addresses:(.*$)'\nreplace: \"\\1 {{ dns1 }}, {{
> dns 2}}\"\n  ^ here\nWe could be wrong, but this one looks like
> it might be an issue with\nmissing quotes.  Always quote template
> expression brackets when they\nstart a value. For instance:\n\n
>   with_items:\n  - {{ foo }}\n\nShould be written as:\n\n
>   with_items:\n  - \"{{ foo }}\"\n"}
> 

If you add this sed to correct the formatting somewhat 
  ansible-playbook playbbok.yml | sed 's/\\n/\n/g'

you'll see that is pointing to your double quote in the replace line.


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f181b28f-ce68-f1b0-552c-3efc52e4c256%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: In ansible how do cp -rp

2019-03-21 Thread eric.b.hymowitz via Ansible Project
Ansible has a "shell" and a "command" module, both of which allow you to 
pass arbitrary Unix commands to the remote host.

Also, the -r flag has no use on a single file.

--EbH

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dae8ff29-0470-4664-ab81-b92c5cf26a08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread John Harmon
I have tried single quotes too around the regexp, but get a similar issue

TASK [dns_update : include_tasks] 

fatal: [ansible-ub18]: FAILED! => {"reason": "Syntax Error while loading 
YAML.\n  found unknown escape character\n\nThe error appears to have been 
in '/etc/ansible/role/dns_update/tasks/Ubuntu18.yml': line 7, column 15, 
but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\nregexp: 
'.*nameservers.*$\\n.*addresses:(.*$)'\nreplace: \"\\1 {{ dns1 }}, {{ 
dns 2}}\"\n  ^ here\nWe could be wrong, but this one looks like 
it might be an issue with\nmissing quotes.  Always quote template 
expression brackets when they\nstart a value. For instance:\n\n   
 with_items:\n  - {{ foo }}\n\nShould be written as:\n\n   
 with_items:\n  - \"{{ foo }}\"\n"}



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/aff533c9-7f61-4c73-a600-60fc643b7a59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread Matt Martz
I'd recommend any time you need to use escape characters, that you use
single quotes around the value, instead of double quotes.  It will resolve
many of the issues with how pyyaml does it's parsing

On Thu, Mar 21, 2019 at 12:04 PM John Harmon 
wrote:

>
> Sorry, last error message is slightly innaccurate I was testing a
> change in that one (difference is brackets [ ]):
>
> TASK [dns_update : include_tasks]
> 
> fatal: [ansible-ub18]: FAILED! => {"reason": "Syntax Error while loading
> YAML.\n  found unknown escape character\n\nThe error appears to have been
> in '/etc/ansible/role/dns_update/tasks/Ubuntu18.yml': line 7, column 15,
> but may\nbe elsewhere in the file depending on the exact syntax
> problem.\n\nThe offending line appears to be:\n\nregexp:
> \".*nameservers.*$\\n.*addresses:(.*$)\"\nreplace: \"\\1 {{ dns1 }}, {{
> dns 2}}\"\n  ^ here\nWe could be wrong, but this one looks like
> it might be an issue with\nmissing quotes.  Always quote template
> expression brackets when they\nstart a value. For instance:\n\n
>  with_items:\n  - {{ foo }}\n\nShould be written as:\n\n
>  with_items:\n  - \"{{ foo }}\"\n"}
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/85332d11-9309-4182-8d94-c47a1c1cc6a9%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v-GBSyFBAcsv2SnVtY69eghYpeXc5e5A2v%3Deu7MZ62Rvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread John Harmon

Sorry, last error message is slightly innaccurate I was testing a 
change in that one (difference is brackets [ ]):

TASK [dns_update : include_tasks] 

fatal: [ansible-ub18]: FAILED! => {"reason": "Syntax Error while loading 
YAML.\n  found unknown escape character\n\nThe error appears to have been 
in '/etc/ansible/role/dns_update/tasks/Ubuntu18.yml': line 7, column 15, 
but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\nregexp: 
\".*nameservers.*$\\n.*addresses:(.*$)\"\nreplace: \"\\1 {{ dns1 }}, {{ 
dns 2}}\"\n  ^ here\nWe could be wrong, but this one looks like 
it might be an issue with\nmissing quotes.  Always quote template 
expression brackets when they\nstart a value. For instance:\n\n   
 with_items:\n  - {{ foo }}\n\nShould be written as:\n\n   
 with_items:\n  - \"{{ foo }}\"\n"}


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/85332d11-9309-4182-8d94-c47a1c1cc6a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] replace module regexp with newline character

2019-03-21 Thread John Harmon
I need to use replace to find a regexp that includes \n; however, I keep 
getting an error.  How can I properly do this (don't even know if I am 
using back reference correct either, but if I can get past this error I 
think I can figure that part out)?
Thanks in advance!

---
# DNS Update For Ubuntu 18
- name: Update DNS servers
  replace:
path: /etc/netplan/50-cloud-init.yaml
regexp: ".*nameservers.*$\n.*addresses:(.*$)"
replace: "\1 {{ dns1 }}, {{ dns 2}}"
  notify: "{{ handler_name }}"

Error:
TASK [dns_update : include_tasks] 

fatal: [ansible-ub18]: FAILED! => {"reason": "Syntax Error while loading 
YAML.\n  found unknown escape character\n\nThe error appears to have been 
in '/etc/ansible/role/dns_update/tasks/Ubuntu18.yml': line 7, column 15, 
but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\nregexp: 
\".*nameservers.*$[\\n].*addresses:(.*$)\"\nreplace: \"\\1 {{ dns1 }}, 
{{ dns 2}}\"\n  ^ here\nWe could be wrong, but this one looks 
like it might be an issue with\nmissing quotes.  Always quote template 
expression brackets when they\nstart a value. For instance:\n\n   
 with_items:\n  - {{ foo }}\n\nShould be written as:\n\n   
 with_items:\n  - \"{{ foo }}\"\n"}



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/23bf3a96-b90c-49f3-93d6-65ff4ac3e5d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] In ansible how do cp -rp

2019-03-21 Thread ryad9200000
Hi all,

I want do this command line in ansible :

*cp -rp /home/user/file1   /home/user/directory2/file2*

I have find this module copy :

- name: example copying file with owner and permissions
  copy:
src: /srv/myfiles/foo.conf
dest: /etc/foo.conf
owner: foo
group: foo
mode: 0644

this task works But this task not sauvegarde all caracteristic of file1 (*date 
create*, etc ...) as linux command *"cp -rp /**home/user/file1 
/home/user/directory2/file2"*

Someone have an idea please ? 

Thanks community ansible !! ;)

Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3e32d0c9-630d-4903-b42e-988233716e3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible slack callback plugin - not working - please help

2019-03-21 Thread Sreenivas Chokkarapu
I was able to resolve that 404 error;  an employee who created the slack 
token left the company and the IT disabled it. 

Thanks

Sreenivas

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/67c6bb8f-b29f-4887-a691-b1eccf78d3b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Using defaults for Ansible user module for for "home", "group" and "groups"

2019-03-21 Thread Suhail Choudhury
Hi,

I'm trying to set optional values only if they are specified for the "user" 
module.

So with:

- name: Add users
  user:
name: "{{ item.username }}"
comment: "{{ item.comment }}"
state: present
shell: "{{ (item.shell) | default('/bin/bash') }}"
password: "{{ item.password }}"
update_password: always
  with_items: "{{ merged_users }}"
  tags: users

I only have to add an optional shell variable with anotehr value such as 
'/bin/ksh' to override the default bash value.

How can I do the same for:

home: "{{ item.home }}"
group: "{{ item.group }}"
groups: "{{ item.groups }}"

As the home directory defaults to '/home/username', group defaults to 
'username' and groups also defaults to 'username'.

I've tried something like:

group: "{{ (item.group) | default('/bin/bash') }}"

but no joy.

So please help with these 3 values - how do I define defaults for "home", 
"group" and "groups"?

Regards,
Suhail.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5e68c09e-9473-481f-942b-7fbaee9de3b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] include_playbook / include tasks from Bitbucket?

2019-03-21 Thread Michael Mullay
Yes, AWX let you use any kind of remote repo as a data source. Although I
have not used it in a couple of years.

On Thu, Mar 21, 2019, 12:46 AM TOB  wrote:

> Okay, going to take a look on it - thanks. Do you know if it's possible to
> use pull on Ansible AWX?
>
>
>
> Am Donnerstag, 21. März 2019 01:52:33 UTC+1 schrieb Michael M:
>>
>> Yeah I have not tried to execute a playbook like that so I don't have
>> anything to offer there. I've done your exact scenerio though using
>> ansible-pull to run a playbook from my BitBucket repo.
>>
>>
>> On 3/20/19 8:05 AM, TOB wrote:
>>
>> Good morning then! :)
>>
>> I'll take a look. The weird thing is following: The remote server is
>> cloning the files (checked it manually if they're there) but with
>> "include_tasks" or "import_playbook" I'm not able to execute the playbooks
>> lying around there.
>>
>>
>>
>> Am Mittwoch, 20. März 2019 15:49:54 UTC+1 schrieb Michael M:
>>>
>>> Sorry, yes, too early for clear thinking. ;)
>>>
>>> I was thinking of ansible-pull. I know Brian Coca that frequents this
>>> forum had a github or galaxy entry on the subject some time ago but I can't
>>> seem to find it. But this is a good reference (or you can just do a 'man
>>> ansible-pull'):
>>>
>>> http://manpages.ubuntu.com/manpages/trusty/man1/ansible-pull.1.html
>>>
>>>
>>> On 3/20/19 7:36 AM, TOB wrote:
>>>
>>> Hi Michael,
>>>
>>> thanks for your answer. I'm already using it, it's in the first code
>>> block above.
>>>
>>>
>>> Best
>>>
>>>
>>>
>>> Am Mittwoch, 20. März 2019 15:29:45 UTC+1 schrieb Michael M:

 There is a git module for this purpose which may work better for you.


 https://docs.ansible.com/ansible/latest/modules/git_module.html#git-module


 On 3/20/19 7:25 AM, TOB wrote:

 Hi everyone,

 short summary: I have a playbook from where I wanna start other
 playbooks hosted on Bitbucket. In short words: Got a server and want to
 clone repository on Bitbucket where are all the other playbooks which I
 want to run on the remote server.

 --- - name: Deploy   hosts: all   become: yes   tasks: # INSTALL GIT
 ON REMOTE MACHINE   - name: Install GIT apt:   pkg: -
 git # CLONE GIT REPO ON REMOTE MACHINE   - name: Connect to Bitbucket
 repo git:   repo: ssh://
 usern...@bitbucket.org/repository/repository.git   accept_hostkey:
 yes   version: master   dest: /home/username/git/
 key_file: /home/username/.ssh/id_rsa # FETCH YML FROM BITBUCKET   -
 name: Fetch yml from remote fetch:   remote_src: yes   src:
 /home/username/git/playbookfolder/playbook.yml   dest: /
 flat: yes   - name: Run yml include_tasks: "/home/username/git/
 playbookfolder/playbook.yml"


 It's cloning and saving the git repository on the host machine. But now
 I want to run a playbook / include tasks on it. It's trying to find the
 playbook on the Ansible controller but it should search on the remote
 server I cloned the repo to. Getting this one:

 PLAY [Deploy] *
 TASK [Gathering Facts]
 * ok: [xxx.xxx.
 xxx.xxx] TASK [Install GIT]
 * ok: [xxx.
 xxx.xxx.xxx] => {"cache_update_time": 1550376354, "cache_updated":
 false, "changed": false} TASK [Connect to Bitbucket repo]
 *** changed: [xxx.xxx.xxx.
 xxx] => {"after": "XXX", "before": "XXX", "changed": true,
 "remote_url_changed": false} TASK [Fetch yml from remote]
 *** ok: [xxx.xxx.xxx.
 xxx] => {"changed": false, "checksum": "x", "dest":
 "/playbook.yml", "file":
 "/home/username/git/playbookfolder/playbook.yml", "md5sum": "x"}
 TASK [Run yml]
 * fatal
 : [xxx.xxx.xxx.xxx]: FAILED! => {"reason": "Unable to retrieve file
 contents\nCould not find or access
 '/home/username/git/playbookfolder/playbook.yml' on the Ansible
 Controller.\nIf you are using a module and expect the file to exist on the
 remote, see the remote_src option"} PLAY RECAP
 *
 xxx.xxx.xxx.xxx: ok=4changed=1unreachable=0
  failed=1



 I'm pretty sure I'm using the wrong syntax, but cannot figure out which
 is the right one. This one here is working but it's not doing the things I
 wrote in those different playbooks.

 [...]
 # FETCH UBUNTU / UPGRADE FROM BITBUCKET
   - name: Fetch yml from remote
 fetch:
   remote_src: yes
   src: /home/username/git/playbookfolder2/playbook1.yml
   dest: /
   flat: yes
  

[ansible-project] Re: Do the target systems need to have pre-requisites installed for Ansible to work?

2019-03-21 Thread eric.b.hymowitz via Ansible Project
The answer to your question is "Yes and no."

The actual Ansible software and Ansible modules and Ansible configuration 
files only get installed on the control host.

The client hosts still need some basic software for Ansible to connect to 
them and run, such as Python and certain Python modules, and probably SSH 
keys.

These are usually part of a "base" system install.  They aren't specific to 
Ansible, so they're not typically considered "part of an Ansible 
installation".  But it's possible that you still need to install a few 
things on the clients for Ansible to work properly.

I hope that explains it.

--EbH

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3b3c08fb-3a81-49d2-9464-c70a8a9b11c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Importing user variables from multiple variable sources

2019-03-21 Thread Suhail Choudhury
Thanks for your earlier reply Adam.

So how can I combine variables for a list of "users" defined like so:

*group_vars/all*

users:
  - name: alice
comment: Alice

*group_vars/group1*

users:
  - name: bob
comment: Bob

*host_vars/host1*

users:
  - name: charlie
comment: Charlie

How can all these variables be combined using "loop" or "with_items"?
What if there are duplicates?
Can the "host_vars/host1" variables override and take precedence over the 
"group_vars/all" variables?

Regards,
Suhail.

On Sunday, 3 March 2019 00:25:46 UTC, Adam E wrote:
>
> I have a similar issue and solved it by this PR 
> https://github.com/ansible/ansible/pull/51466 . if you want to use it, 
> just grab the source code and add it to your local library directory until 
> it's merged.  Also see this thread 
> https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/ansible-project/Ssnk6exNjNs/sCKlrOp_FQAJ
>
> With the approach above, the code would merge together all lists that 
> match a pattern, this way you can defined as many "users" variables as you 
> want as long as they are unique and start with say "users_"
>
> If you don't want to copy the library or wait for the PR, then you could 
> also just merge a set of predefined lists.
>
> ie..  
> with_items: "{{ users_host|default([]) + users_group_l1|default([]) + 
> users_group_l2|default([[) }}"
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6e8b7c8b-2c76-4104-8fa9-9297b2109db6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible slack callback plugin - not working - please help

2019-03-21 Thread Sreenivas Chokkarapu
Hello Matt,
>
> I'm stuck with the same issue of 


 [WARNING]: Could not submit message to Slack: HTTP Error 404: Not Found

I'm using ansible 2.4.2, is it possible to get these changes into 2.4.2 release?

Regards,

Sreenivas.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7eb76cd3-977c-47f3-a52b-bb69de49c497%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Number of loops from command line

2019-03-21 Thread Jakub Kafka
Thanks, thats work, bud i have another problem. Here is my code. If i loop 
more than 2, how can i these 2(and more) results, pass to file. it only 
pass 1.

- gather_facts: false
  hosts: localhost
  tasks:
- set_fact:
db: "{{ lookup('password', '/dev/null chars=ascii_letters,digits 
length=32') }}"
usr: "{{ lookup('password', '/dev/null chars=ascii_letters,digits 
length=39') }}"
password: "{{ lookup('password', '/dev/null chars=ascii_letters,digits 
length=21') + '' }}"
  with_sequence: end={{ number }}
- local_action: shell echo "{{ db }}__{{ usr }} {{ db }} {{ password }}" >> 
/tmp/pass_pokus3








Dne středa 20. března 2019 17:16:29 UTC+1 Kai Stian Olstad napsal(a):
>
> On 20.03.2019 15:30, Jakub Kafka wrote: 
> > i have question. Can i specify number of loops from command line 
> > --extra_vars? II want specify number of password to be generated. 
>
> Of course, with variables you can do almost everyting. 
>
>   - debug: var=item 
> with_sequence: end={{ number }} 
>
>
> ansible-playbook -e number=3 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8d132c6f-b357-4470-bd60-8cbc2edda221%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Gathering facts for windows hosts runs forever/never completes

2019-03-21 Thread Gustaf Ankarloo
Thank you for your suggestions.

I'm in version 2.7.0
and apparently it's the 'platform' subset that hangs.


On Mon, Mar 18, 2019 at 8:30 PM Jordan Borean  wrote:

> What version of ansible are you on? IIRC there was a bug fixed in an older
> release that caused it to be really slow in a domain environment. It was
> fixed in 2.4, 2.5 https://github.com/ansible/ansible/pull/38646.
>
> If that isn't it you can use gather subset to try and track down what
> subset is hanging like;
>
> - hosts: windows
>   gather_facts: no
>   tasks:
>   - setup:
>   gather_subset:  # uncomment it one by one until it starts hanging
>   - min
>   #- hardware
>   #- network
>   #- external
>
> You can get a full list of groups here
> https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/setup.ps1#L68
> .
>
> Thanks
>
> Jordan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ad918a57-5ebb-4588-965a-3c61aeb209c1%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
MVH
Gustaf Ankarloo
0723-232344

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CABMkOOtEfZngmizt8MzhP9TDhddrOeAxPy-MjSXMLsTn6oCn4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Convert a text file with list of strings into yml help

2019-03-21 Thread Saranya Nagaraj
Thank you Kai. That helped.

On Mar 20, 2019 2:04 AM, "Kai Stian Olstad" 
wrote:

> On 19.03.2019 20:09, Saranya N wrote:
> > I'm having a text file with lots of strings like below.
> >
> > Cat test.txt
> > String1
> > String2
> > .
> > .
> > .
> > Etc
> >
> > I literally have 2k of strings on that file.
> >
> > I want to convert to yank like below.
> >
> > _ _ _
> >
> > Listofstrings:
> >- string1
> >- string2
> >
> > ...etc
> >
> >
> > I can achieve this via shell script but is there an ansible way of doing
> it using lineinfile or anything else?
> >
> > I know I can achieve via jinja2​ tempalte as well but I don't know how
> to loop over the strings in the text file in j2 template.
>
> You can create a variable with the list like so
>
>   - set_fact:
>   listofstrings: '{{ listofstrings | default([])  + [item] }}'
> with_lines: cat test.txt
>
> and then you can do all sort of thing with the variable listofstrings in
> Ansible.
>
>
> --
> Kai Stian Olstad
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/il1LDL5H4xQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/ae70bfbe-7a63-28e0-53e9-fb7fa7a74470%40olstad.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPYop%2Bi6TreCSgPau8i7QESVJikaJEkehxmCtm6WmkOyq8xOwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] include_playbook / include tasks from Bitbucket?

2019-03-21 Thread TOB
Okay, going to take a look on it - thanks. Do you know if it's possible to 
use pull on Ansible AWX?



Am Donnerstag, 21. März 2019 01:52:33 UTC+1 schrieb Michael M:
>
> Yeah I have not tried to execute a playbook like that so I don't have 
> anything to offer there. I've done your exact scenerio though using 
> ansible-pull to run a playbook from my BitBucket repo.
>
>
> On 3/20/19 8:05 AM, TOB wrote:
>
> Good morning then! :) 
>
> I'll take a look. The weird thing is following: The remote server is 
> cloning the files (checked it manually if they're there) but with 
> "include_tasks" or "import_playbook" I'm not able to execute the playbooks 
> lying around there. 
>
>
>
> Am Mittwoch, 20. März 2019 15:49:54 UTC+1 schrieb Michael M: 
>>
>> Sorry, yes, too early for clear thinking. ;) 
>>
>> I was thinking of ansible-pull. I know Brian Coca that frequents this 
>> forum had a github or galaxy entry on the subject some time ago but I can't 
>> seem to find it. But this is a good reference (or you can just do a 'man 
>> ansible-pull'):
>>
>> http://manpages.ubuntu.com/manpages/trusty/man1/ansible-pull.1.html
>>
>>
>> On 3/20/19 7:36 AM, TOB wrote:
>>
>> Hi Michael, 
>>
>> thanks for your answer. I'm already using it, it's in the first code 
>> block above.
>>
>>
>> Best
>>
>>
>>
>> Am Mittwoch, 20. März 2019 15:29:45 UTC+1 schrieb Michael M: 
>>>
>>> There is a git module for this purpose which may work better for you.
>>>
>>>
>>> https://docs.ansible.com/ansible/latest/modules/git_module.html#git-module
>>>
>>>
>>> On 3/20/19 7:25 AM, TOB wrote:
>>>
>>> Hi everyone, 
>>>
>>> short summary: I have a playbook from where I wanna start other 
>>> playbooks hosted on Bitbucket. In short words: Got a server and want to 
>>> clone repository on Bitbucket where are all the other playbooks which I 
>>> want to run on the remote server.
>>>
>>> --- - name: Deploy   hosts: all   become: yes   tasks: # INSTALL GIT ON 
>>> REMOTE MACHINE   - name: Install GIT apt:   pkg: - git # 
>>> CLONE GIT REPO ON REMOTE MACHINE   - name: Connect to Bitbucket repo   
>>>   git:   repo: ssh://
>>> usern...@bitbucket.org/repository/repository.git   accept_hostkey: 
>>> yes   version: master   dest: /home/username/git/   key_file
>>> : /home/username/.ssh/id_rsa # FETCH YML FROM BITBUCKET   - name: Fetch 
>>> yml from remote fetch:   remote_src: yes   src: /home/
>>> username/git/playbookfolder/playbook.yml   dest: /   flat: yes 
>>>   - name: Run yml include_tasks: "/home/username/git/playbookfolder/
>>> playbook.yml"
>>>
>>>
>>> It's cloning and saving the git repository on the host machine. But now 
>>> I want to run a playbook / include tasks on it. It's trying to find the 
>>> playbook on the Ansible controller but it should search on the remote 
>>> server I cloned the repo to. Getting this one: 
>>>
>>> PLAY [Deploy] * 
>>> TASK [Gathering Facts] 
>>> * ok: [xxx.xxx.
>>> xxx.xxx] TASK [Install GIT] 
>>> * ok: [xxx.
>>> xxx.xxx.xxx] => {"cache_update_time": 1550376354, "cache_updated": false
>>> , "changed": false} TASK [Connect to Bitbucket repo] 
>>> *** changed: [xxx.xxx.xxx.
>>> xxx] => {"after": "XXX", "before": "XXX", "changed": true, 
>>> "remote_url_changed": false} TASK [Fetch yml from remote] 
>>> *** ok: [xxx.xxx.xxx.xxx
>>> ] => {"changed": false, "checksum": "x", "dest": "/playbook.yml"
>>> , "file": "/home/username/git/playbookfolder/playbook.yml", "md5sum": 
>>> "x"} TASK [Run yml] 
>>> * fatal: 
>>> [xxx.xxx.xxx.xxx]: FAILED! => {"reason": "Unable to retrieve file 
>>> contents\nCould not find or access 
>>> '/home/username/git/playbookfolder/playbook.yml' on the Ansible 
>>> Controller.\nIf you are using a module and expect the file to exist on the 
>>> remote, see the remote_src option"} PLAY RECAP 
>>> * 
>>> xxx.xxx.xxx.xxx: ok=4changed=1unreachable=0   
>>>  failed=1   
>>>
>>>
>>>
>>> I'm pretty sure I'm using the wrong syntax, but cannot figure out which 
>>> is the right one. This one here is working but it's not doing the things I 
>>> wrote in those different playbooks.
>>>
>>> [...]
>>> # FETCH UBUNTU / UPGRADE FROM BITBUCKET
>>>   - name: Fetch yml from remote
>>> fetch:
>>>   remote_src: yes
>>>   src: /home/username/git/playbookfolder2/playbook1.yml
>>>   dest: /
>>>   flat: yes
>>>   import_playbook: playbook1.yml
>>>
>>> # FETCH INSTALL LAMP FROM BITBUCKET
>>>   - name: Fetch and run other one
>>> fetch:
>>>   remote_src: yes
>>>   src: /home/username/git/playbookfolder2/playbook2.yml