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
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:
>
>>
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
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
}}"
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
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
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
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
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
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
>
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
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
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
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
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
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
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
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:
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:
>
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
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
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 -
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
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):
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
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
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
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:
>
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
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_
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
*
> 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
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
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
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
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
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
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
>
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
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
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
******
> 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
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 }}"
>
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
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
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.
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
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
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: "{{
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
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
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
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
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
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 <
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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"
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
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
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
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
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:
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')
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
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"
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
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
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
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
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:
}}"
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
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
91 matches
Mail list logo