Re: [ansible-project] iterate with_file contents ?

2018-12-06 Thread Nicolas G.
worked like a charm , thank you so much Kai Stian ! On Thu, Dec 6, 2018 at 4:00 AM Kai Stian Olstad < ansible-project+l...@olstad.com> wrote: > On 06.12.2018 08:12, Nicolas G wrote: > > I have some files under my role path dir : > > > > ls roles/my-role/files/ > >

[ansible-project] iterate with_file contents ?

2018-12-05 Thread Nicolas G
I have some files under my role path dir : ls roles/my-role/files/ file1 file2 file3 I can display the content of the file by running : - name: display contents debug: msg: "{{ item }}" with_file: - "roles/my-role/files/file1" if in the last line I try something like :

Re: [ansible-project] concatenate a value with another variable in default filter

2017-01-05 Thread Nicolas G
int. > > The only real place to define a variable that can be used in the `hosts` > declaration is via the command line via -e/--extra-vars > > On Thu, Jan 5, 2017 at 8:10 AM, Nicolas G <nico...@gmail.com > > wrote: > >> I have the bellow Ansible inventory : >> >

Re: [ansible-project] Re: Random return host in groups and balanced accross the cluster

2016-02-22 Thread Nicolas G
Brian Coca can you be more specific ? I'm trying something like the bellow but I"m stuck, it's deploying all the servers in every run instead of only a random one .. {% for host in groups['dbservers'] %} {% if loop.index % (loop.length + 1) %} server_address = {{ host }} {{ loop.index %

[ansible-project] Re: Random return host in groups and balanced accross the cluster

2016-02-18 Thread Nicolas G
Thank you Paul , that seems to work . However I'm not completely satisfied with how balanced the random filter has worked. Do you know if there is a better way to have the server_address more equally balanced across a big bluster of servers ? On Wednesday, February 17, 2016 at 9:07:59 PM

[ansible-project] Random return host in groups and balanced accross the cluster

2016-02-17 Thread Nicolas G
Hi, I have an inventory file with the bellow servers : # servers [dbservers] db01 db02 db03 db04 In my template I want to populate the config by choosing randomly one of the servers from the dbservers group . Unfortunately the bellow will return all servers : {% for host in

[ansible-project] Re: Ansible 2 template src path changed ?

2016-01-27 Thread Nicolas G
As suggested by James Camarata in the webinar , the template module code has changed a lot. I'v created an issue in https://github.com/ansible/ansible/issues/14161 . On Tuesday, January 26, 2016 at 1:23:59 PM UTC-5, Nicolas G wrote: > > Hi > > I have the bellow template stored unde

[ansible-project] Ansible 2 template src path changed ?

2016-01-26 Thread Nicolas G
Hi I have the bellow template stored under the shared role but it's been deployed by other roles as in our web role in our example : # roles/shared/templates/config.conf.j2 #roles/web/taks/main.yml : - name: deploy config template: src=config.conf.j2 dest=/etc/project/config.conf In

[ansible-project] SG access different per environment

2015-12-17 Thread Nicolas G
Hi, I have the bellow security groups that is working : name: modify sg_default rules local_action: module: ec2_group region: "us-east-1" vpc_id: "{{ vpcid }}" name: "test" rules: - proto: all cidr_ip: "{{ office_ip }}"

[ansible-project] looping display in local facts

2015-11-05 Thread Nicolas G
Hi, I have the bellow local fact working : # /etc/ansible/facts.d/monitoring.fact [tags] web= db= app= In my template I have the bellow jinja code : {% for facts in ansible_local.monitoring.tags %} {{ facts }} {% endfor %} However this is rendering the facts tags like this : web app db

[ansible-project] ec2 inventory to return Name tags

2015-10-15 Thread Nicolas G
Hi, I'm able to run Ansible on AWS using ec2.py successfully but unfortunately I get the public DNS of the instance instead of the Name tag : ansible -i plugins/inventory/ec2.py "tag_Environment_prod" -m shell -a "uptime" ec2-54-205-89-44.compute-1.amazonaws.com | success | rc=0 >> Filesystem

[ansible-project] ec2 inventory tags combination

2015-10-15 Thread Nicolas G
Hi, Following the https://docs.ansible.com/ansible/intro_dynamic_inventory.html#using-multiple-inventory-sources example, I have inventory file were I have defined my physical and aws servers using ec2 tags as a group in it : # servers.txt : " [tag_Type_Web] [web:children]

[ansible-project] filter to exclude a string pattern ?

2015-09-17 Thread Nicolas G
Hi, I have the bellow values written from some vars , they all have a pattern 'xyz_' on front : xyz_name_1 xyz_name_2 xyz_special_3 xyz_other_4 Is there a filter I can use to exclude the 'xyz_' pattern so my values will be more clear like : name_1 name_2 special_3 other_4 ??? -- You

[ansible-project] manually define an inventory var when there is no inventory file

2015-09-14 Thread Nicolas G
Hi All, I have the following template : *# web_cconfig.j2 :* *web_servers={% for host in groups['web'] %} {{ host }}, {% endfor %}* This file is deployed in a role and using the server list from the inventory web group and working OK, the problem is when there are cases I need to use the

[ansible-project] Re: ansible-pull not working

2015-07-22 Thread Nicolas G
working now, I had to remove the git clone step as this is incorporated in ansible-pull . On Wednesday, July 22, 2015 at 2:01:16 AM UTC+3, Nicolas G wrote: Hi, I'm trying to launch an ec2 instance and bootstrap it using ansible-pull through user-data but unfortunately I'm having some

[ansible-project] ec2_asg timeout issue

2015-07-22 Thread Nicolas G
Hi, I have the bellow config using the ec2_asg module : # AutoScaling group - ec2_asg: name: asg state: present region: {{ region }} load_balancers: {{ elb_name }} availability_zones: [ '{{ az1 }}', '{{ az2 }}', '{{ az3 }}' ] launch_config_name: config

Re: [ansible-project] Re: ec2_asg timeout issue

2015-07-22 Thread Nicolas G.
cheers somehow I didn't noticed these 2 options, I'v set wait_for_instances to False. On Wed, Jul 22, 2015 at 8:29 PM, Jon Hadfield hadfie...@gmail.com wrote: Have you tried specifying a wait_timeout, i.e.: - wait_for_instances Wait for the ASG instances to be in a ready state

[ansible-project] ansible-pull not working

2015-07-21 Thread Nicolas G
Hi, I'm trying to launch an ec2 instance and bootstrap it using ansible-pull through user-data but unfortunately I'm having some difficulties . The user-data (https://gist.github.com/nicolas-g/d648db66ee9db2a15af7) is a bash script that will install ansible , git and make all the setup so I

Re: [ansible-project] var values in the same line

2015-06-30 Thread Nicolas G.
the negative look ahead pattern of regexp I will pass it to you tomorrow if someone else do not beat me Stay tuned Phil 2015-06-30 11:09 GMT+02:00 Nicolas G nicol...@gmail.com: Hi all, We have a role var defined for every role like bellow : # roles/db/vars/main.yml : role : db

[ansible-project] Ansible Jinja indentation bug ?

2015-06-29 Thread Nicolas G
Hi, I have the bellow vars to populate a template , it works almost fine but the final file result you can see there is some indentation problem : # vars : datadog_http_checks: - name : mycheck url : http://localhost:9090/hc/ threshold : 5 window : 5 timeout : 1 # template:

[ansible-project] include all roles tags in a file

2015-06-23 Thread Nicolas G
Hi all, This is another issue I'm running with the migration from Chef to Ansible. In Chef you can use chef search in your code logic to do various things. We need to set a tag inside a config file for every role we run on the server the same way as Chef because our monitoring system

Re: [ansible-project] Help how to achieve the same like in Chef

2015-06-21 Thread Nicolas G
%} # in normal pool part of config {% for host in fullpool %} {% if loop.index % 5 != 4 %} {{host}} {% endif%} {% endfor %} On Fri, Jun 19, 2015 at 12:18 PM, Nicolas G nico...@gmail.com javascript: wrote: Hi, I'm trying to migrate from Chef a recipe for HAProxy

[ansible-project] Help how to achieve the same like in Chef

2015-06-19 Thread Nicolas G
Hi, I'm trying to migrate from Chef a recipe for HAProxy. In the bellow config one of the pool groups are considered to be coming from slow server connections and we isolate them to use certain number of web servers and not all of them as when you have lot's of requests with relatively higher

[ansible-project] advanced Jinja config

2015-05-27 Thread Nicolas G
Hi, I need help with the bellow configuration in Jinja, I'm using a for loop to populate the hosts from a group defined in my inventory and that's working good but what my application requires is a letter in front of every host in alphabetical order depending how many host numbers I have : #

Re: [ansible-project] advanced Jinja config

2015-05-27 Thread Nicolas G
() }}:{{ host }}{% if not loop.last %},{% endif %}{% endfor %} This creates a 'cycler' with the lowercase letters of the english alphabet, and cycles through them on each iteration of the for loop. On Wed, May 27, 2015 at 1:33 PM, Nicolas G nico...@gmail.com javascript: wrote: Hi, I need

Re: [ansible-project] balanced configuration

2015-05-21 Thread Nicolas G
, 2015 at 11:11 PM, Nicolas G nico...@gmail.com javascript: wrote: Hi, We have a 2 tiers environment where the front-end servers connects to the backend servers. As an example we have 30 application servers and 3 backend servers, let's say every backend server should support up to 10

[ansible-project] balanced configuration

2015-05-19 Thread Nicolas G
Hi, We have a 2 tiers environment where the front-end servers connects to the backend servers. As an example we have 30 application servers and 3 backend servers, let's say every backend server should support up to 10 frontend servers. We need Ansible to automatically setup the configuration

[ansible-project] Does ansible -m ec2 works ?

2015-05-12 Thread Nicolas G
Hi, I would like to launch an ec2 instance the same way you can with chef-knife : ansible localhost -m ec2 -a key_name=test group=qa instance_type=t2.micro image=ami-aecd60c7 wait=true exact_count=1 instance_tags=testing --connection=local but Im getting this error : localhost | FAILED {

Re: [ansible-project] Re: return code from dict ?

2015-04-30 Thread Nicolas G.
- Matt On Wednesday, April 29, 2015 at 8:06:33 AM UTC-7, Nicolas G wrote: Hi, I have a plabyook that checks if my python app has been installed and only run pip install if the packages have not been installed. Unfortunately because I'm doing a check using with_items the register value

Re: [ansible-project] using Ansible-Vault vars to run local bash scripts

2015-01-18 Thread Nicolas G.
why depositing the secrets into a file alongside the script would be any less secure than hardcoding them in the script? Tom On 15 January 2015 at 17:30, Nicolas G. nicol...@gmail.com wrote: Thanks for the reply Tom but both of your suggestions doesn't really help with the security concerns

Re: [ansible-project] using Ansible-Vault vars to run local bash scripts

2015-01-15 Thread Nicolas G.
. Alternatively you could maybe write them to files on the target host (be it localhost or another host) with tight permissions and remove afterwards? Regards Tom On 15 January 2015 at 14:52, Nicolas G nicol...@gmail.com wrote: Hi, I have a bash script that i would like to run locally

[ansible-project] using Ansible-Vault vars to run local bash scripts

2015-01-15 Thread Nicolas G
Hi, I have a bash script that i would like to run locally using the Ansible shell module , the problem is that want to use some encrypted variables from Ansible-Vault in that bash script but I think for security reasons ansible-vault variables are not rendered from the shell module.. Is there

[ansible-project] Re: Add EC2 security group - only if it not already exists

2015-01-15 Thread Nicolas G
hi, I think when I was trying the ec2_group module for some reason it will only fail if the security group already exists but was not created by the module, if you create a new security group using the ec2_group module it wont fail when you run the same playbook again. On Wednesday, January

[ansible-project] Re: Can I do yum localinstall with the yum module?

2015-01-15 Thread Nicolas G
If I'm not wrong it acts like the yum command, if the rpm exist locally the yum module will just work like the yum localinstall command. In your example this will install the RPM on the destination system as long you don't have anywhere defined connection: local or local_action . On Thursday,

[ansible-project] Ansible facts help (ansible_fqdn)

2014-11-20 Thread Nicolas G
Hi, Im trying to use Ansible magic var inventory_hostname along with ansible_fqdn fact. I have a playbook that will update the hostname of the system based on the entry in the inventory file and later it will use ansible_fqdn value to configure a file. Unfortunately the ansible_fqdn keeps the

Re: [ansible-project] Re: Ansible facts help (ansible_fqdn)

2014-11-20 Thread Nicolas G
using set_fact so you don't have to re-gather facts in this situation. Thanks! On Thu, Nov 20, 2014 at 10:22 AM, Nicolas G nico...@gmail.com javascript: wrote: Sorry , the correct playbook is the one bellow, the setup module executed before the debug action at the end: - hosts: all

Re: [ansible-project] Re: Ansible facts help (ansible_fqdn)

2014-11-20 Thread Nicolas G
at 10:22 AM, Nicolas G nico...@gmail.com javascript: wrote: Sorry , the correct playbook is the one bellow, the setup module executed before the debug action at the end: - hosts: all tasks: - name: update the hostname hostname: name={{ inventory_hostname }} - name: boot

Re: [ansible-project] Re: Ansible facts help (ansible_fqdn)

2014-11-20 Thread Nicolas G
I'm expecting ansible_fqdn to have the same value as inventory_hostname , see my test playbook and output bellow : - name: show inventory_hostname debug: msg=inventory_hostname is {{ inventory_hostname }} - name: show ansible_fqdn debug: msg=ansible_fqdn is {{ ansible_fqdn }} - name:

Re: [ansible-project] Re: Ansible facts help (ansible_fqdn)

2014-11-20 Thread Nicolas G
I think I found the most weird bug that was driving me crazy, it seems for some strange reason when you have in your playbook vars_files with the name based on a variable the ansible_fqdn keeps the old value... Here are all the steps to reproduce it in ansible 1.7.1 : create the bellow 3 files

Re: [ansible-project] Re: Ansible facts help (ansible_fqdn)

2014-11-20 Thread Nicolas G
What's the ETA for 1.8 ? On Friday, November 21, 2014 12:13:42 AM UTC+2, James Cammarata wrote: Ahh yes, this was a bug in 1.7.x which has been fixed in devel and will be included in 1.8. On Thu, Nov 20, 2014 at 3:15 PM, Nicolas G nico...@gmail.com javascript: wrote: I think I found

[ansible-project] Ansible-pull fail tasks notifications ?

2014-10-30 Thread Nicolas G
Hi, One of the benefits of running Ansible in push mode is that you can see exactly when and what task have failed. I'm planning to use ansible in pull mode and I would like to know when a task have failed in pull mode by getting a notification. Is that possible ? Regards, N. -- You

[ansible-project] Strange behaviour or misconfig ? (RDS and local connection)

2014-10-27 Thread Nicolas G
Hi All, I'm using the bellow config in order to deploy Ansible in AWS with no problem , the *db* servers are actually *RDS* instances and the rest is all EC2 instances. ### inventory hosts file: [db] db1.example.com ansible_connection=local [web] web1.example.com web2.example.com

[ansible-project] Re: tomcat service to start only after the Redis replication is completed

2014-09-03 Thread Nicolas G
: result.stdout.find(up) != -1 retries: 5 delay: 10 Thanks for the help ! On Wednesday, September 3, 2014 1:22:42 PM UTC+3, Frank Steffen wrote: You may delete or rotate the log file before. Am Dienstag, 2. September 2014 12:46:34 UTC+2 schrieb Nicolas G: Hi Frank, thanks for the reply. I

[ansible-project] Re: tomcat service to start only after the Redis replication is completed

2014-09-02 Thread Nicolas G
schrieb Nicolas G: Hi, We use a single redis master server and many slave nodes that are running tomcat along with the redis slave service. One of the problems I have is that I need my tomcat application to start when the replication is completed, on my playbook I first install and start

[ansible-project] tomcat service to start only after the Redis replication is completed

2014-09-01 Thread Nicolas G
Hi, We use a single redis master server and many slave nodes that are running tomcat along with the redis slave service. One of the problems I have is that I need my tomcat application to start when the replication is completed, on my playbook I first install and start redis slave service

[ansible-project] pagerduty module not working

2014-08-06 Thread Nicolas G
Hi, I'm trying to use the pagerduty module with no luck, when I run the bellow tasks with the right credentials I get a failed to create the window: HTTP Error 400: Bad Request : TASK: - name: Create a 1 hour maintenance window in PagerDuty pagerduty: name=mydomain user=u...@mydomain.com

[ansible-project] how to set defaults for ec2_facts when not in AWS ???

2014-05-20 Thread Nicolas G
Hi, We have our ansible playbooks working with no problem to deploy our servers in Amazon ec2. One of the ansible modules we use is the ec2_facts in order to configure some files , as for example we use the {{ ansible_ec2_placement_availability_zone }} value. There is a chance we need to

[ansible-project] is it possible for a task to use a different template depending of the role ?

2014-02-11 Thread Nicolas G
Hi, I have agent-install.yml that installs our application agent and deploys the agent-config template, since agent-install.yml is shared by many roles it's located under the common role tasks : role/common/tasks/agent-install.yml role/common/template/agent-config.j2 This tasks will be run

[ansible-project] Re: Configuring Ansible to run play books through a bastion host on aws/ec2

2014-02-06 Thread Nicolas G
A different approach is to setup your bastion with an OpenVPN server, then your client as a laptop will be using the bastion server as a Network Gateway, the IP will be showing as your are connecting from the bastion server. On Wednesday, February 5, 2014 8:59:17 PM UTC+2, Jeff Lord wrote:

[ansible-project] Re: Ansible book

2014-01-20 Thread Nicolas G
I just found this one in case you are still interested : https://www.packtpub.com/ansible-configuration-management/book On Thursday, March 28, 2013 2:57:20 PM UTC+2, João Paulo Mafra wrote: Hi! Anyone knows if there is any book about Ansible or if someone is writing a book on it? Thank

[ansible-project] Re: Question about best practice approach to indicate that something is already setup

2014-01-13 Thread Nicolas G
Hi Randy, I had the same case but couldn't find an RPM version besides the java openjdk which is not suitable for our application, this is the tasks I'm using in Ansible to install Java jdk-1.6.0_26-fcs.x86_64 version downloaded from Oracle and saved in a S3 bucket : - name: register if java

[ansible-project] credentials problem when running ansible-pull from cron

2013-11-29 Thread Nicolas G
Hi All, This is a simple playbook I have to test the S3 module which is working fine but I'm having problems when I run the same in pull mode from cron: # s3example.yml --- - hosts: localhost connection: local user: root tasks: - name: download file from s3 s3: bucket=my-bucket