Re: [ansible-project] Question on using the Ansible API

2020-06-23 Thread Pshem Kowalczyk
Hi, I had a similar requirement, but decided to approach it a bit differently. In my case the playbook always had to be run first, so I simply collected all the variables I needed into one dictionary and then stored that dictionary in a file for further reuse by other components. kind regards

Re: [ansible-project] yum downgrade is not working in Ansible Command module

2019-07-17 Thread Pshem Kowalczyk
Run playbook with '-vv' appended and show us the output. kind regards Pshem On Wed, 17 Jul 2019 at 18:18, Rahul Kumar wrote: > No -y option also does not work. Well yum downgrade is a valid > command and working outside Ansible. > > On Wed, 17 Jul 2019 at 11:44, Michael Mullay wrote: > >>

Re: [ansible-project] Re: connect to AWS instance as root doesn't fail

2019-07-11 Thread Pshem Kowalczyk
Hi, The following solution comes to mind - on the controller run a playbook that connects to the instances using the 'command' or 'shell' module (so delegate_to: localhost) and inspect the output of the ssh command. Based on the output of that playbook - create an inventory that stores

Re: [ansible-project] How to debug Ansible modules

2019-06-04 Thread Pshem Kowalczyk
This should be of help: https://docs.ansible.com/ansible/latest/dev_guide/debugging.html kind regards Pshem On Tue, 4 Jun 2019 at 19:05, Wawrzek Niewodniczanski wrote: > Hi, > > I'm looking to peek into an Ansible module. It is the 'unarchvie' > module which in special circumstances is not

Re: [ansible-project] Re: A10 Networks modules - Request for Testing and feedback

2019-04-22 Thread Pshem Kowalczyk
}}" timeout: 60 register: exec_result which is executed from a loop, one call at a time. kind regards Pshem On Tue, 23 Apr 2019 at 11:54, David Carrasco wrote: > Gotcha so does that mean you use Python scripts to leverage the A10 API, > or do you somehow integrate Ansible with Pyth

Re: [ansible-project] Re: A10 Networks modules - Request for Testing and feedback

2019-04-22 Thread Pshem Kowalczyk
Hi, We use the A10s. Those modules turned out to be not particularly useful for us, so we ended up using the API extensively to get information (both config and operational) from the devices. kind regards Pshem On Tue, 23 Apr 2019 at 04:24, David Carrasco wrote: > I am very new to both

Re: [ansible-project] Access to variables defined in roles from python script

2019-03-07 Thread Pshem Kowalczyk
Hi, Have a look here: https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html You'll need to build your own module that you can invoke from your task list or role. kind regards Pshem On Thu, 7 Mar 2019 at 22:09, wrote: > I am an ansible newbie. My first non-trivial

Re: [ansible-project] Help on terminal and cliconf plugin

2019-03-05 Thread Pshem Kowalczyk
Hi, I've written those plugins for some of our in-house devices. Key points: - You have to tell Ansible where your plugins are, either using environmental variables or via ansible.cfg - You'll need a module that actually uses your plugins - The ios.py (in plugins/cliconf and plugins/terminal) is

Re: [ansible-project] using when something > variable

2019-03-04 Thread Pshem Kowalczyk
Hi, inside 'when' all variables are automatically accessible, so you don't have to use brackets. This should work: when: item.acl_mask >= threshold kind regards Pshem On Tue, 5 Mar 2019 at 07:39, Spiro Mitsialis wrote: > I have a playbook that performs a command on a router and then parses

Re: [ansible-project] Except Module in Ansible

2019-03-03 Thread Pshem Kowalczyk
Hi, Have you installed the pyexpect on the remote machine against which you're executing the playbook? kind regards Pshem On Thu, 28 Feb 2019 at 00:17, Deepak Sharma wrote: > Hi All, > > I am using except module to install one TIBCO products , > > - name: Start Streambase installation >

Re: [ansible-project] How to detect AWS instance type

2019-02-26 Thread Pshem Kowalczyk
Hi, Depending what you're after, something like this to figure out the instance type: - name: determine if we're on a nitro hypervisor set_fact: on_nitro: "{{ ansible_ec2_instance_type.startswith('t3') or ansible_ec2_instance_type.startswith('c5') or ansible_ec2_instance_type.startswith('m5') or

Re: [ansible-project] Running as inexistent non-root user in Docker container

2019-02-11 Thread Pshem Kowalczyk
Hi, Why not simply create a dedicated ansible user inside the container? kind regards Pshem On Tue, 12 Feb 2019 at 05:08, Luca Pireddu wrote: > Hello, > > I'm wondering if anyone can help me run ansible as an inexistent user in a > docker container. > > I'm trying to build a docker container

Re: [ansible-project] Boot signal from a remote Pi

2019-01-28 Thread Pshem Kowalczyk
Hi, One way of doing it would be to use ansible in 'pull' mode in one of the boot scripts (like rc.local). kind regards Pshem On Sun, 27 Jan 2019 at 03:00, Sergio Fernández wrote: > Hi there! > > I would like to know the best way to perform this: > > I will be using the Vault (from

Re: [ansible-project] UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure.

2018-12-20 Thread Pshem Kowalczyk
Hi, This might happen if for some reason ansible was previously run on that host with root privileges (probably using sudo or su without changing the home directory). Please make sure that /home/karol/.ansible is in fact writable by the user 'karol'. kind regards Pshem On Thu, 20 Dec 2018 at

Re: [ansible-project] Ansible and ip6tables

2018-12-02 Thread Pshem Kowalczyk
Google seems to index not the most recent version of the docs. Here's the current version: https://docs.ansible.com/ansible/latest/modules/iptables_module.html Here's an example: - iptables: chain: INPUT protocol: tcp destination_port: 8080 jump: ACCEPT rule_num: 5

Re: [ansible-project] Re: ansible-pull configuration

2018-08-28 Thread Pshem Kowalczyk
Hi, I have never attempted to use ansible in pull mode on anything than the localhost. I have ran the same playbook on multiple nodes at once but they were not 'in-sync' - each one of them run tasks independently. If you need to run something on multiple machines I suggest you 'nest' the call to

Re: [ansible-project] Timeouts using AWS modules

2018-08-28 Thread Pshem Kowalczyk
This generally indicates connectivity problems. Are you behind a proxy of some sort (might be transparent). I have seen those sort of issues in various corporate environments that used proxies to inspect all traffic. kind regards Pshem On Wed, 29 Aug 2018 at 02:31 Karl Auer wrote: > I am

Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread Pshem Kowalczyk
ory.\n\nPlease make > sure you have the correct access rights\nand the repository exists.\n" > > Can you please help me out on this > > > Looking forward for your reply > > > Thanks & Regards > Sumit Sahay > 07044112109 > > On Thu, Aug 16, 2018 at 3:

Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread Pshem Kowalczyk
Hi, That's correct, in pull mode ansible modifies and sets things on the machine on which it runs. The easiest way of providing inventory in this case is via command line: -i $(hostname), Please note the comma at the end. kind regards Pshem On Wed, 15 Aug 2018 at 02:55 SUMIT SAHAY wrote: >

Re: [ansible-project] ansible-pull configuration

2018-08-08 Thread Pshem Kowalczyk
Hi, Ansible in pull mode is basically the same as regular ansible-playbook. The only difference is that you have to supply a repo URL from which the playbook and the roles are to be downloaded. The same directory structure works with both modes. If you're using ansible-pull to hydrate

Re: [ansible-project] Speeding up very large playbooks

2018-08-07 Thread Pshem Kowalczyk
https://docs.ansible.com/ansible/2.5/user_guide/playbooks_async.html > > On Mon, Aug 6, 2018 at 6:46 PM Pshem Kowalczyk wrote: > >> Hi, >> >> We have a scenario where we pre-generate a lot of configuration on the >> controller host (targets are generally network devic

[ansible-project] Speeding up very large playbooks

2018-08-06 Thread Pshem Kowalczyk
Hi, We have a scenario where we pre-generate a lot of configuration on the controller host (targets are generally network devices, so not capable of running python). Typical generation process involves pulling data from a number odelef different systems (over APIs), running some local modules -

Re: [ansible-project] can we encrypt a string (password) using ansible vault.

2018-08-05 Thread Pshem Kowalczyk
Hi, Have a look here: https://docs.ansible.com/ansible/latest/user_guide/vault.html#use-encrypt-string-to-create-encrypted-variables-to-embed-in-yaml kind regards Pshem On Mon, 6 Aug 2018 at 16:02 coach rhca wrote: > Hi, > > can we encrypt a string (password) using ansible vault. I have a

Re: [ansible-project] Convert an XML to JSON using ansible

2018-05-08 Thread Pshem Kowalczyk
Hi, THe quickest way is to create your own filter: 1. Create a 'filter_plugins' directory (in the same directory as you playbook or roles). 2. Create a xml2json.py file in that directory with the following content: ## cut below class FilterModule(object): def filters(self):

Re: [ansible-project] Ansible in High Availability

2018-04-15 Thread Pshem Kowalczyk
There is nothing about pure ansible HA because ansible is effectively stateless. You can run the same playbooks on another machine (or multiple machines at once) with no problem as long as ansible is installed there. My only suggestion is to use some sort of version management (like git) to store

Re: [ansible-project] ImportError: No module named ansible.constants

2018-03-29 Thread Pshem Kowalczyk
If you're not using pip or other package manger you have to setup your paths: http://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#tarballs-of-tagged-releases source ./hacking/env-setup kind regards Pshem On Fri, 30 Mar 2018 at 11:18 John Wick

Re: [ansible-project] Ansible dynamic looping

2018-02-01 Thread Pshem Kowalczyk
not create a list of servers in inventory. > > > On Thursday, 1 February 2018 21:08:51 UTC-5, Pshem Kowalczyk wrote: > >> with_items requires a list to iterate over. I think one way of achieving >> your outcome is to create a group in the inventory and populate it with the >&g

Re: [ansible-project] Ansible dynamic looping

2018-02-01 Thread Pshem Kowalczyk
with_items requires a list to iterate over. I think one way of achieving your outcome is to create a group in the inventory and populate it with the hosts and run the playbook against that group. kind regards Pshem On Fri, 2 Feb 2018 at 13:02 Andrew Morgan wrote: >

Re: [ansible-project] Ansible - AWS - Security Group

2018-01-16 Thread Pshem Kowalczyk
group_name: example-other > # description to use if example-other needs to be created > group_desc: other example EC2 group > > Regards, > Reddy > > On Wednesday, 17 January 2018 06:56:00 UTC+11, Pshem Kowalczyk wrote: > >> It seems like

Re: [ansible-project] jenkins ansible template

2018-01-16 Thread Pshem Kowalczyk
Kumar <sidhurana@gmail.com> wrote: > Thanks Pshem but i am still getting same result. > > Regards, > Sudhir > > > On Wednesday, January 17, 2018 at 12:15:59 AM UTC+1, Pshem Kowalczyk wrote: > >> Your 'sudoer' is a string, you want the with_

Re: [ansible-project] jenkins ansible template

2018-01-16 Thread Pshem Kowalczyk
Your 'sudoer' is a string, you want the with_items to iterate over a list. Try this: with_items: "{{ sudoers.split(',') }}" kind regards Pshem On Wed, 17 Jan 2018 at 12:00 Sudhir Kumar wrote: > Hi, > > i am trying to add multiple sudoers line with template. > > so, i

Re: [ansible-project] Ansible - AWS - Security Group

2018-01-16 Thread Pshem Kowalczyk
* > ok: [localhost] > > PLAY RECAP > *** > localhost : ok=1changed=0unreachable=0failed=0 > > Regards, > Reddy > > On Sunday, 14 January 2018 19:12:50 UTC+11, Pshem Kowalczyk wrote: > >> This looks like a de

Re: [ansible-project] Ansible - AWS - Security Group

2018-01-14 Thread Pshem Kowalczyk
This looks like a definition of a role, not a play. If you want this to be a play you have to turn this into the 'tasks' section of the yaml file and specify at least hosts you want this ran against. kind regards Pshem On Sun, 14 Jan 2018 at 19:17 Reddy Myyb wrote: > The

Re: [ansible-project] Ansible Tower installation as DR mode

2018-01-11 Thread Pshem Kowalczyk
All Tower instances must be able to access the same database. If you can ensure that you can have Tower instances in different sites (or availability zones). kind regards Pshem On Thu, 11 Jan 2018 at 17:44 Vijay Choudhary wrote: > Hi, just want to know can we

Re: [ansible-project] Changing credentials between tasks

2017-12-13 Thread Pshem Kowalczyk
Hi, One thing comes to mind - you could create two different entries in the inventory pointing to the same 'ansible_host' with different set of credentials. So the bootstrap process could run against the the first host (with default password) and the rest of the play - against the second. The

Re: [ansible-project] Run once with when statement causes only skipped action to run

2017-12-09 Thread Pshem Kowalczyk
If you're using ec2.py to get your dynamic inventory you might use the dynamic groups created from tags (tag_NAME_VALUE). If you dynamically create the host before having to access it you can use: - meta: refresh_inventory to re-run the inventory script (which should discover newly created EC2

Re: [ansible-project] Ansible Host Machine Query

2017-12-05 Thread Pshem Kowalczyk
Hi, Yes, it's possible. You'll have to specify the inventory you want your playbooks to run against in the command line. kind regards Pshem On Wed, 6 Dec 2017 at 03:55 Tsatish Kumar wrote: > Hi Team, > > Can any one let me know, whether is it possible to Manage 2

Re: [ansible-project] using tests to match a hostname

2017-12-04 Thread Pshem Kowalczyk
The match is a regular expression match (not a wildcard match). If you want something ending in 'd' try this: search('d$') kind regards Pshem On Tue, 5 Dec 2017 at 13:08 Luke Miller wrote: > > I am trying to use tests to match a hostname, I want hostnames that end in >

Re: [ansible-project] generate template once for group of hosts

2017-12-01 Thread Pshem Kowalczyk
You can do the following (use two tasks instead of one 'template'): 1. Generate the template on the controller host (with delegate_to: localhost and run_once: true) 2. Copy the generated template to all the other hosts kind regards Pshem On Sat, 2 Dec 2017 at 17:53 tomr

Re: [ansible-project] Ansible hangs when calling a script that runs commands over ssh

2017-11-25 Thread Pshem Kowalczyk
Hi, Are you sure you have key-based ssh setup correctly on the remote machine? Can ansible user find and access the ssh key required? Are you using the right user on the remote machine to ssh to the other machine? Is the public SSH key of the other machine already in know hosts (or are you

Re: [ansible-project] Ansible network

2017-11-22 Thread Pshem Kowalczyk
er variables written > already? > > > On Wednesday, November 22, 2017 at 4:35:38 PM UTC+8, Pshem Kowalczyk wrote: > >> Hi, >> >> Try this: >> >> - name: DEPLOY SNMP COMMANDS WITHIN PB >> delegate_to: localhost >> ios_config: >> pro

Re: [ansible-project] Ansible network

2017-11-22 Thread Pshem Kowalczyk
****** > sltnrmgmt : ok=1changed=0unreachable=0failed=1 > > > > > On Tuesday, November 21, 2017 at 3:31:43 PM UTC+8, Pshem Kowalczyk wrote: > >> Now the issue is caused by indentatio

Re: [ansible-project] Problem with variables variables

2017-11-20 Thread Pshem Kowalczyk
Hi, Try this: {{ vm_list.virtual_machines[vmname].uuid }} kind regards Pshem On Tue, 21 Nov 2017 at 04:11 Josu Vilda wrote: > Hi, > > I have a problem with variables. > > this is correct: > . > - debug: > msg: "{{ vm_list.virtual_machines.SRV1.uuid }}" >

Re: [ansible-project] Ansible network

2017-11-20 Thread Pshem Kowalczyk
here > > > On Friday, November 17, 2017 at 5:16:24 PM UTC+8, Pshem Kowalczyk wrote: > >> Hi, >> >> You need a space between the dash '-' and 'name:' in the task list. >> I suggest you find a text editor that supports YAML validation to make >> your life e

Re: [ansible-project] or condition in ansible skips the hosts that are not matched in condition

2017-11-19 Thread Pshem Kowalczyk
Ansible operates on an internal loop. Tasks are executed (and facts set) on 'per-device' basis. If you need the results of all the checks I suggest you do the following: 1. Register the results and store them into files on the controller (either can run as internal ansible loop or manual set of

Re: [ansible-project] Unable to SSH to localhost

2017-11-18 Thread Pshem Kowalczyk
Is there any particular reason you have to ssh to localhost? Ansible will work fine if you specify connection=local in inventory. In this case it does look like you're missing the private key (or at least ansible can't find it). Make sure you can ssh ansible@127.0.0.1 before you run ansible.

Re: [ansible-project] Rescue all hosts if one host fails

2017-11-17 Thread Pshem Kowalczyk
Hi You can use the following method (sorry I don't have the playbook ready). 1. Run the upgrade on each host, ignore errors, but register the results and store them in a file on the controller machine (you can also manually - fail: once the error is registered for a given host) 2. Once all

Re: [ansible-project] Ansible network

2017-11-17 Thread Pshem Kowalczyk
Hi, You need a space between the dash '-' and 'name:' in the task list. I suggest you find a text editor that supports YAML validation to make your life easier. kind regards Pshem On Fri, 17 Nov 2017 at 20:42 SK wrote: > Hi, > > I am using Ansible for the

[ansible-project] Re: Using ansible inside EC2 instance to gather tags

2017-11-15 Thread Pshem Kowalczyk
So far I came up with the following, but it does feel a bit kludgy: - name: check if running inside AWS uri: url: http://169.254.169.254/latest/meta-data timeout: 2 register: aws_uri_check failed_when: False - name: store result set_fact: inside_aws: "{{

[ansible-project] Using ansible inside EC2 instance to gather tags

2017-11-15 Thread Pshem Kowalczyk
Hi, We're starting to move our setup to AWS. In order to get an EC2 instance provisioned we use ansible in 'pull' mode. That works fine. The one thing that seems to be a problem is getting the tags assigned to the instance. If the playbook is ran from the 'outside' the inventory script supplies

Re: [ansible-project] Is there a cleaner alternative to '{{ (things | json_query("[?name==''" + thing_name + "'']") }}'

2017-10-29 Thread Pshem Kowalczyk
You can move the actual query string to a separate variable to reduce some clutter and string concatenation. You can also use ` (backticks) to quote jmes_path strings: set_fact: enabled_ports: "{{ intfs | json_query(enabled)}}" vars: enabled: "values(@)[?is_enabled

[ansible-project] Ansible-pull and cloud-init and HOME variable

2017-10-16 Thread Pshem Kowalczyk
Hi, I thought I share some info on what took me a few hours of debugging to discover when it comes to using ansible to hydrate ubuntu-based instances using cloud-init. It looks like cloud-init doesn't set HOME variable which prevents a number of modules from working correctly. The modules that

Re: [ansible-project] Is there a way to provide default values to a set of tasks?

2017-10-02 Thread Pshem Kowalczyk
th: "{{my_force_basic_auth}}" > body_format: "{{my_body_format}}" > > > This is what I am trying to avoid. I want to tell Ansible: "Hey, for all > the uri tasks, use these values as defaults". > > > On Monday, October 2, 2017 at 6:18:42 PM U

Re: [ansible-project] Is there a way to provide default values to a set of tasks?

2017-10-02 Thread Pshem Kowalczyk
Hi, If you want to use 'global' variables like that you have a few choices: 1. Use 'group_vars/all.yaml' (all hosts belong to 'all' group by default) 2. Use 'defaults/main.yaml' under your role more info here: http://docs.ansible.com/ansible/latest/playbooks_best_practices.html#directory-layout

Re: [ansible-project] Using Netbox to set variables in my playbook

2017-09-12 Thread Pshem Kowalczyk
Hi, I haven't tried to use netbox that way, but since it does provide an API you should be able to use it with the uri module: http://docs.ansible.com/ansible/latest/uri_module.html kind regards Pshem On Tue, 12 Sep 2017 at 18:58 'Marco Baldanza' via Ansible Project <

Re: [ansible-project] How to get all the instances per VPC and get security group of each instance for a particular zone.

2017-09-04 Thread Pshem Kowalczyk
You need a number of separate steps: 1. Get VPC id (ec2_vpc_net_facts) 2. Get list of instances in that VPC using vpc-id as a filter (ec2_remote_facts) 3. Get the list of ENIs for each of those EC2 instances (ec2_eni_facts) The last module will return information about security groups used by

Re: [ansible-project] Re: Structuring and managing multiple unrelated projects

2017-09-03 Thread Pshem Kowalczyk
Hi, I think it's down to your work split/structure. In our case each project operates on separate set of hosts. So we have separate inventories for each of them. Perhaps there's some sort of logical grouping structure you could create for your hosts and run playbooks based on those groups (with a

Re: [ansible-project] iterating using with_list

2017-08-30 Thread Pshem Kowalczyk
that despite lack of documentation it is supported after all. kind regards Pshem On Thu, 31 Aug 2017 at 06:53 Kai Stian Olstad < ansible-project+l...@olstad.com> wrote: > On 30. aug. 2017 01:09, Pshem Kowalczyk wrote: > > After a bit of googling I found 'with_list' which works grea

Re: [ansible-project] Structuring and managing multiple unrelated projects

2017-08-30 Thread Pshem Kowalczyk
Hi, I don't think I have an answer for you, but faced with a similar problem (being able to reuse roles and yet have separate projects) we started investigating the following solution. At this stage we're only trying this with one and a bit of (smallish) projects so I'm unsure how well this is

[ansible-project] iterating using with_list

2017-08-29 Thread Pshem Kowalczyk
Hi, I have a requirement to iterate over list of lists: panels: - - name: disk_used_pt iterate: - path - name: diskio_all - - name: system_load_all - name: process_all I've tried with_items on that structure, but it flattens

Re: [ansible-project] debugging nested list

2017-08-24 Thread Pshem Kowalczyk
Your 'packages1' is a dictionary/hash not a list/array, so if you want to iterate over it you have to use with_dict. kind regards Pshem On Thu, 24 Aug 2017 at 14:07 Henry Medina wrote: > Hello Folks, > > > I have a debugging question that has left me scratching my

Re: [ansible-project] Install and use Ansible with a non-root account

2017-08-23 Thread Pshem Kowalczyk
You can use ansible on a controller without root privileges. Level of privileges on the remote host you mange depends on what you're trying to achieve. In most cases you'll need root access, since you're making system-wide changes. kind regards Pshem On Thu, 24 Aug 2017 at 08:59 Joaquin Tejada

Re: [ansible-project] Plugins and roles

2017-08-22 Thread Pshem Kowalczyk
Hi, I don't think there's an easy way of passing an array, the params is just a string that gets parsed in the plugin. I ended up writing my own modules (instead of plugins) for functions that required multiple parameters (or dict/list parameters). kind regards Pshem On Wed, 23 Aug 2017 at

Re: [ansible-project] Re: ec2_lc - launch configuration user data - uploads to aws OK but disappears!!

2017-08-16 Thread Pshem Kowalczyk
Hi, The user_data must be the actual script you want to run, so it shouldn't have any additional formatting and should start with #!/bin/bash. Something like this should work: user_data: | #!/bin/bash source /home/centos/startup.sh kind regards Pshem On Thu, 17 Aug 2017 at

[ansible-project] Get a list of Elastic IPs

2017-08-15 Thread Pshem Kowalczyk
Hi, Is there a way of getting elastic IPs in AWS account? I can see that most other AWS modules have a _fact version of itself (like ec2_vpc_net and ec2_vpc_net_facts) but I don't see ec2_eip_facts there. kind regards Pshem -- You received this message because you are subscribed to the Google

Re: [ansible-project] Re: Possible to set default value for missing key when using with_items and when?

2017-08-13 Thread Pshem Kowalczyk
Hi, You can always use " | default('value') " filter if you're not sure if a value is there. Value can be also a list or a dictionary. Alternatively for 'when' you can test if the value is defined: when: item.my_var is defined and my_var == kind regards Pshem On Mon, 14 Aug 2017 at

Re: [ansible-project] Unable to attach an EIP to a VPC Instance

2017-08-03 Thread Pshem Kowalczyk
Hi, Try specifying "private_ip_address" of the ENI that you're allocating elastic IP to. kind regards Pshem On Fri, 4 Aug 2017 at 05:36 Stephen Nelson-Smith wrote: > > I'm trying to attach an elastic IP to an instance in a VPC, but despite > following what seem to be

Re: [ansible-project] use ansible configuration h3c and huawei s series switch from china

2017-07-28 Thread Pshem Kowalczyk
Hi, You didn't say what type of switch you're trying to access. There is a module for the CloudEngine (CE) switches. If you have a different one you have the following options: 1. Adapt native ansible modules for Cisco (using ssh and 'native' configuration) 2. Create a driver module for

Re: [ansible-project] Storing IP address of First node (Control Node) in variable

2017-07-26 Thread Pshem Kowalczyk
Ansible runs an implicit loop for all the devices. If you access a variable in the 'regular' way you can only see variabels/facts set for the current device. Variables/facts set for other devices (that the loop already ran through) can be accessed via the 'hostvars' variable. If you know that you

Re: [ansible-project] Re: ERROR! 'with_ldap' is not valid attribute for a Task

2017-07-21 Thread Pshem Kowalczyk
Since those look like plugins (and not modules) - copy the files from filter_plugins and lookup_plugins to the directories in your setup (if you don't have those dirs create them at the same level as your playbook). kind regards Pshem On Sat, 22 Jul 2017 at 00:10 Grzegorz Sz.

Re: [ansible-project] ERROR! 'with_ldap' is not valid attribute for a Task

2017-07-21 Thread Pshem Kowalczyk
Hi, I'm not sure which module you're referring to, but in your playbook you use 'debug' module. Also the 'with_ldap' section is not indented correctly - if it's a parameter to a module it has to be indented more then the name of the module you're using. kind regards Pshem On Fri, 21 Jul 2017

Re: [ansible-project] Additional argument to git module?

2017-07-19 Thread Pshem Kowalczyk
You can always use shell or command module to execute git binary directly with necessary arguments. kind regards Pshem On Thu, 20 Jul 2017 at 10:18 Denise Draper wrote: > I need to be able to supply git clone with the additional argument > --no-single-branches, which

Re: [ansible-project] How to use set_fact to set a new host fact based on when conditionals.

2017-07-06 Thread Pshem Kowalczyk
You're most likely after inventory_hostname variable (not ansible_hostname). kind regards Pshem On Thu, 6 Jul 2017 at 18:20 Alex Lien wrote: > Hi all, > > > I am trying to set a new host fact (is_master, is_slave) based on > comparison of a pre-assigned variable and

Re: [ansible-project] Re: How to reformat a yaml dictionary?

2017-07-03 Thread Pshem Kowalczyk
Hi, If you feel up to it - write a filter plugin. They're quite easy to create. Have a look here for an example: http://www.dasblinkenlichten.com/creating-ansible-filter-plugins/ I use them when I have limited control over the data structure I have to deal with. Even if data manipulation can be

Re: [ansible-project] Passing to make additional nonvalue parameter (like make -e target) on module level

2017-06-28 Thread Pshem Kowalczyk
Probably the easiest way is to run it via 'shell' command. kind regards Pshem On Wed, 28 Jun 2017 at 20:49 Kuba Nowak wrote: > So I have working Makefile and want to run it via Ansible. > https://docs.ansible.com/ansible/make_module.html#options > > But make module does not

Re: [ansible-project] How to add an LXD container on another machine and copy Ansible's public keys to the container?

2017-06-26 Thread Pshem Kowalczyk
Hi, Depending on the distro you run in the container you might be able to use cloud-init for it. This is what I do with ubuntu inside the container: #Create a profile - name: create a bootstrap profile lxd_profile: name: bootstrap description: "used for bootstrapping of containers"

Re: [ansible-project] Anyone have experiences with using lots of groups and group_vars files?

2017-06-26 Thread Pshem Kowalczyk
On Thu, 22 Jun 2017 at 09:30 William Saxton wrote: > New user here trying to figure out the best way to convert our current > server provisioning system to Ansible. Our system uses approx. 5 different > attributes to provision each server and we have about 1,000 servers. I'm

[ansible-project] Verification of changes

2017-06-08 Thread Pshem Kowalczyk
Hi, I'm looking at a project where changes have to be rolled out to a number of hosts, tested and if something is wrong - the previous configuration is restored. The trick is that testing can only happen after the change has been rolled out to all machines (as they provide a single service). I'm

Re: [ansible-project] Re: Analysing large XML objects

2017-05-30 Thread Pshem Kowalczyk
quot;interfaces.interface[?name=='ge-0/0/0']" kind regards Pshem On Wed, 31 May 2017 at 00:35 Daniel JD <dandav1...@gmail.com> wrote: > Theres no build-in module as far as i know, but this project looks > promising: > > https://github.com/cmprescott/ansible-xml > > &g

[ansible-project] Analysing large XML objects

2017-05-29 Thread Pshem Kowalczyk
Hi, I have to analyse relatively large XML objects (Juniper configs). I'd like to check for presence of certain trees, values and attributes. I could write a lookup plugin but that feels like a relatively complicated way to solve a simple problem. Even just loading it as a var would make it

Re: [ansible-project] setting variables inside a loop

2017-05-11 Thread Pshem Kowalczyk
Turns out it's actually a bug in 'include_role' - a bunch of tickets have been opened about this. The general issue is that various types of variables are not visible inside the 'include_role' scope. (see here:

[ansible-project] setting variables inside a loop

2017-05-07 Thread Pshem Kowalczyk
Hi, I think I'm missing something obvious, so please point me in the right direction (ansible 2.3). - name: load and run services include_role: name: "resource_{{ item.resource }}" vars: resource: "{{ item }}" with_items: - "{{ services }}" How do I set the var ('resource')

[ansible-project] Re: Loading vars into a dictionary

2017-05-05 Thread Pshem Kowalczyk
kind regards Pshem On Thu, 4 May 2017 at 14:03 Pshem Kowalczyk <pshe...@gmail.com> wrote: > Hi, > > I'd like to load variables from a file into a dictionary, so I can later > iterate over that dictionary. > > I've managed to load vars into their own dictionaries

[ansible-project] Loading vars into a dictionary

2017-05-03 Thread Pshem Kowalczyk
Hi, I'd like to load variables from a file into a dictionary, so I can later iterate over that dictionary. I've managed to load vars into their own dictionaries based on their name: - name: load services definitions for the product include_vars: file: "../model/service/{{ item }}.yaml"

Re: [ansible-project] Proxy for Cloning Git Repo

2017-03-16 Thread Pshem Kowalczyk
Hi, Have you tried setting the environmental variable HTTP_PROXY to the point to your internal proxy server? http://docs.ansible.com/ansible/playbooks_environment.html kind regards Pshem On Thu, 16 Mar 2017 at 23:17 Taseer Ahmed wrote: > Hi all, > > I wanted to know if

Re: [ansible-project] Apply Task for one Host

2017-03-14 Thread Pshem Kowalczyk
If the requirements per host are different you can do it two ways: 1. Create a role per host 2. Split your current roles into 'generic' that are applicable to all hosts and 'specific' that only apply to given hosts It's probably easier to have a playbook per host then trying to coerce a single

Re: [ansible-project] reboot with ignore_errors still errors out

2017-02-18 Thread Pshem Kowalczyk
Hi, Perhaps not directly answering your question - but a workaround I used in a number of playbooks (added to the tasks that times out, in your case the one that unsets the noout): - name: Unset the noout flag command: ceph osd unset noout register: result until: result.failed is undefined

Re: [ansible-project] remote access to lxc containers on lxc-host without ssh inside the containers

2017-01-25 Thread Pshem Kowalczyk
One could argue that if you run lxc/lxd you're after system-like functionality (and not docker-style containers) hence you treat it the same way you'd treat a VM. One easy way of installing ssh inside a container is to use images with cloud-init. kind regards Pshem On Thu, 26 Jan 2017 at 06:14

Re: [ansible-project] remote access to lxc containers on lxc-host without ssh inside the containers

2017-01-24 Thread Pshem Kowalczyk
Is there any particular reason you don't want have ssh inside the container at least initially? You can always disable it after you're done with initial configuration. kind regards Pshem On Wed, 25 Jan 2017 at 12:31 'Mario Keller' via Ansible Project < ansible-project@googlegroups.com> wrote:

Re: [ansible-project] Design ideas ansible provision with docker compose

2017-01-23 Thread Pshem Kowalczyk
}}" kind regards Pshem On Tue, 24 Jan 2017 at 05:27 Sonny Heer <sonnyh...@gmail.com> wrote: > do you have examples of using lxd/lxc in this use case? initial start - > provision - subsequent starts have provisioning > > > On Monday, January 23, 2017 at 7:23:2

Re: [ansible-project] Design ideas ansible provision with docker compose

2017-01-23 Thread Pshem Kowalczyk
Hi, If you want to run containers, but not necessarily docker - have a look at lxd/lxc. I currently use it exactly the way you mentioned - reusing roles and configs and simply pointing to different environments. kind regards Pshem On Mon, 23 Jan 2017 at 14:24 Sonny Heer