Yes, we did, as this was the structure of every single playbook in our
project. But to be honest, i am blanking out on the solution that we did.
Since I moved to another company last year, i don't have access to the code
base any more :(
I will try to stress my memory to blurt out the solution.
Hi All,
I am trying to understand the changes with Ansible 2.4 that affects the
usage of inventory_dir variable.
Earlier i was using a static host file and in my playbooks, i was heavily
relying on inventory_dir to load variable files which in turn was loading
the target hosts. I understand
Hi,
More indentation doesn't work. Maybe i should think of some other approach
entirely.
Thanks for your help.
BR,
Ishan
On Tuesday, 27 February 2018 17:22:25 UTC+1, Kai Stian Olstad wrote:
>
> On Tuesday, 27 February 2018 16.54.17 CET ishan jain wrote:
> > Hi,
> >
> &g
gt; to python dict, to YAML, to jinja2+YAML. You will need to find a way to
> join them without going through those steps.
>
>
> On Tue, Feb 27, 2018 at 9:34 AM, ishan jain <ishan...@gmail.com
> > wrote:
>
>> Hi Matt,
>>
>> Yes, you are thinking in th
plates/#indent
>
> On Tue, Feb 27, 2018 at 8:54 AM, ishan jain <ishan...@gmail.com
> > wrote:
>
>> I have a large number of YAML files prepared manually which have a fixed
>> structure - list of dictionaries. But within different files, sequence of
>> these key
I have a large number of YAML files prepared manually which have a fixed
structure - list of dictionaries. But within different files, sequence of
these keys and their values differ. I need to manage them automatically, so
i am writing a kind of converter to add marker blocks. But i am stuck at
bool | ternary ('docker1.yaml', 'docker2.yaml') }}"
>
> I'd recommend including the |bool filter regardless, as that is going to
> ensure things are processed as you expect.
>
> On Mon, Feb 19, 2018 at 9:52 AM, ishan jain <ishan...@gmail.com
> > wrote:
>
>> Hi,
>
Hi,
I was trying out a few sample playbooks to understand the difference
between static n dynamic imports, and i am stuck at a point where i am not
sure what am i doing wrong.
*hosts.info*
[docker]
docker1 ansible_host=0.0.0.0
*include_with_vars.yaml*
---
- hosts: docker
tasks:
-
Hi all,
I have a bunch of playbooks which only define what needs to be done, and i
had split my inventory in some logical groups, so each inventory file is a
complete definition of this group and to run run any playbook, i would
simply use the desired inventory file.
The hosts part of my
Hi,
I am using a variables file for assigning values to the variables which i
would then be using in my playbooks. Sometimes the values to these
variables are further variables whose values are resolved at runtime, and
sometimes they have default values as well.
vars.yaml
---
varA:"A"
My previously running playbooks starting giving me error after i updated my
python modules. After a lot of debugging, i identified the problem. The
problem was that following code snippet was working fine until i updated
jinja2 to 2.9
{% for dictValue in someDictVar -%}
#something something
{%
So is there no way to define something like 'global' variables along with
the inventory ? I thought the implicit 'all' group can be treated like
global variables.
On Tuesday, 11 July 2017 19:27:06 UTC+2, Brian Coca wrote:
>
> The 'hostList1' inventory variable is not available until AFTER the
I want to define the target hosts for my playbooks somewhere in the
inventory itself. But apparently, Ansible is resolving target hosts before
it is finished loading the inventory. When i 'include' the file with these
vars, it works just fine.
*inventoryFile.yaml*
[machines]
one
Playbook:
---
- hosts: "{{hostList}}"
vars_files:
- "{{file}}"
tasks:
- debug: var=inventory_hostname
Inventory
[servers]
one ansible_connection=local
two ansible_connection=local
vars.yaml (type 1)
hostList:
- one
- two
Result with type 1 vars (ansible-playbook -i
For some servers in an inventory, i assign a range of ports. I want to use
these ports in my playbooks while keeping them portable and compatible with
any configuration. I am thinking of using variable for ports whose values
are resolved via some script in inventory. Something like this:
--In
I am using docker_container module on my infra quite extensively for some
time and now i am stuck at a problem for which i cannot figure out the
reason. One point to note here is that for the following chances, there is
lesses probability of messing up somewhere else, like in the whole script,
ts
>
> Then your jenkins play just checks out the repo and runs
>
> ansible-playbook -i dev/ site.yml
>
> (i.e. just switch the inventory to the right one).
>
> On 20 June 2017 at 16:37, ishan jain <ishan...@gmail.com >
> wrote:
> > I want to make it useful for
t pull the git repo before you run the inventory?
>
>
> On 20 June 2017 at 15:00, ishan jain <ishan...@gmail.com >
> wrote:
> > I keep my inventory files for each environment in GIT repositories. I am
> > working on some sort of a helper service which i am writing in Ans
I keep my inventory files for each environment in GIT repositories. I am
working on some sort of a helper service which i am writing in Ansible and
this should perform some (housekeeping) tasks on the specified servers,
which i wish to specify using existing inventory files. I want to make the
I want to start a long running task in my playbook and immediately move to
the next task, and handle the async task return code later. Here is what i
have:
---
- hosts: all
tasks:
- name: Invoke jmeter test cases
shell: sleep 10 | echo done
register: out
async: 1000
I am using declarative pipeline and in some of my stages, i need to use
multiple agents while still ensuring the steps are executed in sequence
(not parallel). I don't find a nice way to use multiple agents (maybe
multiple steps) within a stage.
something like:
pipeline {
agent none
I am using declarative syntax to build my pipeline. I am loading several
variables from a properties file in the beginning and i now i would like to
control the 'on which slave node something executes' via variables. But i
cannot figure out how to use variable as a agent label. The following is
Hi all,
I am checking out Ansible tower and since i have a trial license, not sure
if this is the right place to ask. Maybe we have a lot of tower users here.
So the thing is i got into my admin account and trying to setup a few basic
things, and i just cannot setup the 'credentials' for my
Thanks for suggesting ARA. It looks interesting. I am now trying it.
On Thursday, 13 April 2017 15:44:03 UTC+2, Benjamin Redling wrote:
>
> Hi,
>
> Am 13.04.2017 um 13:20 schrieb ishan jain:
> > Is there a way in Ansible to create a host level interceptor which does
>
Is there a way in Ansible to create a host level interceptor which does
'something' in case ansible-playbook command is invoked ?
What i am trying to do here is to get informed periodically about
'ansible-playbook' command invocations anywhere on my host. There are a
large number of users and
I am having problems removing containers after introducing cadvisor -
https://github.com/google/cadvisor/issues/771
All my scripts that removes containers using Ansible docker_container
module (ansible 2.2.1.0) are now failing because of this. I have added
force_kill option, but it does not
Suppose i want to start a docker container and its parameters would differ
based on a condition. Something like this:
docker_container:
name: typeA
image: typeA
volumes:
- a1:a1
- a2:a2
when: type == A
docker_container:
name: typeB
image: typeB
volumes:
-
Thanks, That worked fine. Although i still don't understand what just
happened. You say that earlier it was taking commonFiles as string bu the
error message says 'expecting string found list'.
On Monday, 13 March 2017 20:18:23 UTC+1, Kai Stian Olstad wrote:
>
> On 13. mars 2017 19:08,
I am trying to have a condition on a single item of a 'with_items' list but
as i cannot do it directly, i found the following snippet:
- name: prepare a list of common files that must be copied
set_fact: commonFiles=['1/f1', '1/f2']
- copy: src="{{item}}" dest=2
with_items:
I was working on Ansible version 2.2.0.0 and my playbook was working fine.
I installed a new Ansible host with version 2.2.1.0 and executed the exact
same playbook but this time i encountered some problems. After
investigating, i realized that my playbook had some tabs which are not
valid for
I would suggest that you add server2 as a slave in your Jenkins. Create a
Jenkins job, configure it to run on this slave and specify the Ansible
commands in the build step just like you execute any other shell command.
On Wednesday, 1 March 2017 16:00:01 UTC+1, vu001 wrote:
>
> Hi to all!
>
>
I am preparing some Ansible scripts for a service that works in a
master/slave setup. There is a single docker image for both but the
master/slave behavior will be acquired after configuring some environment
variables.
When i explicitly setup each container, this is roughly how my playbook
Bump!!
There is got to be some trick involved but i can't think of any.
On Wednesday, 30 November 2016 13:30:01 UTC+1, ishan jain wrote:
>
> I have a number of playbooks each related to starting a container for a
> microservice using docker_container module. I supply the variables like
I have a number of playbooks each related to starting a container for a
microservice using docker_container module. I supply the variables like
image name from the outside using YAML var files. Since we never update a
tagged image in our repo, we have deliberately not used "pull: always" in
I have a situation for which we have decided to allow multiple instances of
the same app to run on same host machines. I do not want to modify my
playbook or inventory to incorporate this temporary hack and was wondering
if i can do that simply by modifying host list and some of the variables.
I have a playbook which requires to perform some actions for each string in
a comma separated list. So i put the repeatable tasks in another playbook
and included that in a master playbook using with_items:
- include:included.yaml module="{{item}}"
with_items:
Hi,
I use simple YAML files for defining some constant values to be used in my
playbooks. A typical file would look like this:
var1: abc
var2: xyz
var3:
- item1
- item2
var4:
4.1: a
4.2: b
I simply include the the file(s) like above in my playbooks in vars:
section and all the
would be incredibly unsafe.
>
> You could also look at setting the credential.helper variable in git (`git
> config --global credential.helper store`), but that's beyond the scope of
> this mailing list.
>
> On Tuesday, October 4, 2016 at 8:21:37 AM UTC-7, ishan jain wrote:
&
Seems like there is isn't any module in Ansible which can commit back to a
GIT repo. My case is such that i am allowing the user to create a new
branch in any of our several repositories and with the help of templates,
generate some necessary files, all this via ansible. I am able to clone the
If you know what you are looking for, isn't this the simplest solution - when:
item.item == 'sally'
On Monday, 26 September 2016 19:07:04 UTC+2, ZillaYT wrote:
>
> This gave me a clue. Loop through a registered variable with with_dict in
> Ansible
>
Thanks. That worked perfectly fine.
On Tuesday, 13 September 2016 19:27:49 UTC+5:30, Josh Smift wrote:
>
> ij> The values for first level of keys (key1,key2) will be provided to the
> ij> playbook as variable 'key' and i am trying to use the dictionary
> values
> ij> corresponding to the
I have prepared a YAML file which arrange some constant values as
dictionary of dictionaries:
*values:*
* key1:*
* val1: 1.1*
* val2:*
* - 1.2.1*
* - 1.2.2*
* val3:*
* - 1.3.1*
* - 1.3.2*
* val4:*
*
Suppose i have this var defined in my inventory file:
*[group10*
*host1*
*host2*
*host3*
*[group1:vars]*
*source=/opt/config/*
And my target hosts are a group of 3 or more servers. Now while invoking
the playbook, i would like to override the value of '*source*' variable
only for a single
to set
>
> ansible_winrm_server_cert_validation: ignore
>
>
> In your inventory / group vars
>
> its documented here:
>
> http://docs.ansible.com/ansible/intro_windows.html#inventory
>
> Hope this helps,
>
> Jon
> On Thursday, September 1, 2016 at 11:13:02 AM UTC+1, ishan jain wrote:
>&
I am making some centOS based docker containers to be used as Ansible host.
Initially, i created a container and installed Ansible from source files.
To connect to windows hosts, i installed some modules as and when required.
(honestly, i am not sure what all modules i installed)
Now i created
e that makes sense for your specific structure
> (probably a top level default variable based on your initial post).
>
> It might not even be necessary. For file paths, multiple slashes are
> collapsed into one on most OSes I've tried.
>
> On Monday, August 29, 2016 at 4:43:31 AM UT
I have a variable config_src which i use in a lot many places (host vars,
inventory file, playbook) and its value is supplied at the run time as
extra vars (-e)
This variable is actually a path variable, so i need to ensure that it is
always ending in a '/'. As this variable is in use in a lot
My host file looks something like this:
[Group]
host.com
[Group:vars]
vars="{{src}}/varsFile.yaml
And in my playbook:
---
- hosts: "{{remote_hosts}}"
vars_files:
- "{{vars}}"
gather_facts: yes
tasks:
..
Now when i run this with the command:
ansible-playbook -i host
This seems to be working just fine. Ansible is parsing the variables in
inventory files.
On Wednesday, 17 August 2016 16:21:44 UTC+5:30, Kai Stian Olstad wrote:
>
> On 17. aug. 2016 12:02, ishan jain wrote:
> > I am trying to imply environment wide values via inventory file fo
The documentation says:
*Repository path and tag used to create the container. If an image is not
found or pull is true, the image will be pulled from the registry.*
But a simple usage of docker_container:
*- name: start docker container*
* docker_container:*
*name:
I am trying to imply environment wide values via inventory file for which i
need to use some other variables as values.
My host file looks like this:
[linunx]
linux1
linux2
[windows]
windows1
windows2
[all]
linux
windows
[all:vars]
environment=ABC
client=XYZ
08:07, ishan jain wrote:
> > I am trying to check if a given mount point exists for each host in my
> > playbook. I am trying to generate a kind of report by printing Success
> or
> > Failed using if-else, loops and flags (need something better than flags)
>
> Flag?
I am trying to check if a given mount point exists for each host in my
playbook. I am trying to generate a kind of report by printing Success or
Failed using if-else, loops and flags (need something better than flags)
inside a jinja2 template. First i am looping through all hosts and for each
es on the internet like me are
> going to give you.
>
> On 3 August 2016 at 11:22, ishan jain <ishan...@gmail.com >
> wrote:
> > Roles are reusable, well managed and promotes sharing - this i
> understand
> > very well. But somehow, i do not like them much, specially
Roles are reusable, well managed and promotes sharing - this i understand
very well. But somehow, i do not like them much, specially in enterprise
applications.
The application i am working on is a monolith being converted in small
independent self contained systems. Each deployment is a
required
{{linuxDistribution}} version {{linuxDistributionVersion}}
{% endif %}
{% endfor %}
On Thursday, 21 July 2016 15:27:47 UTC+5:30, Kai Stian Olstad wrote:
>
> On 21.07.2016 10:11, Kai Stian Olstad wrote:
> > On 21.07.2016 09:32, ishan jain wrote:
> >
> >> - I do n
.com/ansible/stat_module.html
>
> On Thursday, 28 July 2016 21:36:56 UTC+12, ishan jain wrote:
>>
>> I am trying to check via Ansible that whether the user (being used to
>> connect) has write access to a given path - both on *linux hosts and
>> windows hosts*.
>&g
so8601 string. I use the iso8601 for one
> playbook where I need a unique string on volume snapshots.
>
> On Thursday, July 28, 2016 at 8:13:13 AM UTC-5, ishan jain wrote:
>>
>> Here is a small part of windows facts:
>>
>> "ansible_facts&qu
I am writing a template in which the warning output is generated if the
winRM certificate of target windows host is going to expire in 1 month. I
just don't see a way how can i compare two dates in jinja2 template.
I have the winrm certificate expiration time in the fact
-
Here is a small part of windows facts:
"ansible_facts": {
"ansible_architecture": "64-bit",
"ansible_date_time": {
"date": "13.07.2016",
"day": "13",
"hour": "06",
"iso8601": "2016-07-13T06:34:29",
"minute":
I am trying to check via Ansible that whether the user (being used to
connect) has write access to a given path - both on *linux hosts and
windows hosts*.
I tried looking around but i could not get an easy way to do that. I might
be getting wrong paths a lot, so the typical commands with raw
not have extensive knowledhe of jinja2 templates and seems like i
will have to learn a few things to create a report template
On Thursday, 21 July 2016 12:44:07 UTC+5:30, Kai Stian Olstad wrote:
>
> On 21.07.2016 08:28, ishan jain wrote:
> > So, does anyone has an idea how i can gener
Hi All,
I am trying to prepare Ansible scripts to check remote hosts for certain
things like - OS version, free disk space etc. I am able to create tasks
for each of this check as Ansible already have a great support for that,
but i am stuck at a place on how to create a final report kind of
has a lot of good starting points for
> converting unix toolbox commands into powershell
> https://www.gitbook.com/book/devopscollective/a-unix-person-s-guide-to-powershell/details
>
> Hope this helps,
>
> Jon
>
>
>
> On Wednesday, July 13, 2016 at 12:06:44 PM
I am trying very hard to get a numerical value of free disk space on a
windows server 2012 R2 machine, but couldn't get it so far. All the
commands that are available for listing the disk space information - they
are not providing the output in proper format. Here are a few commands i
tried:
I am trying to create some configuration files which i intend to copy on
windows host and for that i am using the template module:
- name: generate template
template: src="{{item.src}}" dest="{{item.dest}}"
with_items: "{{files}}"
The destination is the Ansible host itself
I am trying to add a key-value to %PATH% variable in windows and for that i
am using a raw module. But when i use something like:
PATH=E:\jre;%PATH%
then i get error saying,
"%PATH% : The term '%PATH%' is not recognized as the name of a cmdlet
I tried putting things in quote and there are
(I think that the default is 10 hours
> without renewal).
>
> Hope this helps
>
> Jon
>
> On Friday, April 22, 2016 at 12:24:08 PM UTC+1, ishan jain wrote:
>>
>> Do we have a way to undo whatever the script changed ? Or some other
>> means where i can mak
gt; https://github.com/ansible/ansible/issues/15541
>
> On Friday, April 22, 2016 at 10:20:11 AM UTC+1, ishan jain wrote:
>>
>> I configured winrm on my windows server 2012 R2 using the script listed
>> at
>> https://github.com/ansible/ansible/blob/devel/examples/
I configured winrm on my windows server 2012 R2 using the script listed
at
https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
To test the certificate expiration, i provided 3 days for -CertValidityDays
parameter
during script execution. I am not
Put this in your host file
[chs]
10.10.3.21
[chs:vars]
ansible_user: user
ansible_password: pass
ansible_port: 5986
ansible_connection: winrm
Looks like the IP you posted is the actual one for your host. I would
suggest to use dummy values while posting on public forums :-)
On Wednesday, 6
Still couldn't find anything. There's gotta be a way in ansible to specify
this or maybe an option to specify all other switches.
On Thursday, 31 March 2016 10:55:12 UTC+5:30, ishan jain wrote:
>
> As per the Docker docs for Docker run -
> https://docs.docker.com/engine/refe
The information you are looking for in nicely documented in the Ansible
docs - http://docs.ansible.com/ansible/intro_inventory.html
You need to create forlders named exactly as 'group_vars' and 'host_vars'
right beside your host file and in them you create files with the same name
as your
As per the Docker docs for Docker run
- https://docs.docker.com/engine/reference/run/
In the section clean up, it is mentioned that - *to automatically clean up
the container and remove the file system when the container exits, you can
add the --rm flag*
But i can't see any option in Ansible's
I have a pretty straightforward script where i copy some configuration
files from ansible host to a linux machine and then start a docker
container mounting those config files.
My Docker container are immutable, so i don't mind recreating them often.
In fact, i would like to recreate them in
; version of ansible.
>
>
> https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/powershell.ps1#L214
>
> Are you able to try latest development version?
>
> Jon
>
>
> On Monday, 21 March 2016 05:48:53 UTC, ishan jain wrote:
>>
>>
I am trying to check if some symbolic links exists or not on a windows 2012
R2 machine using win_file module. It works fine in case of directory
symbolic links but poses an error when the path specified is a file
symbolic link that is actively being used by a process. This link is a link
to
at I want it in rather than trying to write playbooks that have
> to handle lots of different possiblities that might exist on the different
> machines.
>
> Hope this helps,
>
> Jon
>
> On Wednesday, 16 March 2016 11:46:50 UTC, ishan jain wrote:
>>
>> I am
ths:
>
> So like this (yaml style parameter)
> win_stat:
>path: E:\folder\link.exe
>
> Hope this helps,
>
> Jon
>
> On Wednesday, 16 March 2016 10:01:39 UTC, ishan jain wrote:
>>
>> 4) I have a file symbolic link E:\folder\link.exe pointing to an exe f
I am trying to provision windows server 2012 R2 machine with ansible and
for that i need to gather some custom facts about the running services. I
tried getting the information via the win_service module like this:
---
- hosts: windows
tasks:
- name: check services
win_service:
Still haven't figured out the solution. Need help here...
On Tuesday, 8 March 2016 15:54:53 UTC+5:30, ishan jain wrote:
>
> I am trying to delete a parent dir with lots of stuff inside with the help
> of win_file:
>
> - name: remove all
> win_file: path="E:\root"
>
> You would need the '-ErrorAction SilentlyContinue' bit otherwise when the
> service doesn't exist, Get-Service will fail.
>
> also if you prefer you could do something similar with the sc.exe like this
>
> sc.exe query serviceName
>
> Hope this helps.
>
>
> On
"stat": {
"exists": false
}
}
But when i use:
win_stat: path="E:\\folder\\link.exe"
I get a proper result.
Probably related to the above questions, but *what is the proper syntax to
specify a path here ?*
On Wednesday, 16 March 2016 15:26:05
I am trying to gather custom facts for a windows 2012 R2 server while
avoiding to write powershell scripts. win_stat is something that can
apparently be very useful to me but i am getting confused about its exact
behavior.
I have a file structure like this:
E:\
E:\link1
E:\folder\link2
I am trying to delete a parent dir with lots of stuff inside with the help
of win_file:
- name: remove all
win_file: path="E:\root" state=absent
This folder contains a lot other subfolders and symbolic links within
itself - both directory and file symbolic links. When i try to run this, i
I am copying some text files located on a linux file system to windows file
system using the win_copy module of Ansible. The final copied file do not
have line breaks in it.
So the file which is like this on linux:
line1
line2
line3
Becomes this on windows:
line1line2line3
How can i make
e 2.1.
>
> Also, I wonder if the format of ` - /mydata/folder:/opt/mydata/:Z` might
> be incorrect? I would remove the last '/', changing it to ` -
> /mydata/folder:/opt/mydata:Z`
>
>
>
> --Chris
>
>
> On Monday, February 29, 2016 at 6:29:35 AM UTC-5, ishan jain wrot
When i try to run the following task:
- name: start docker container
docker:
name: container
image: img
state: started
expose:
- 8301:8182
volumes:
- /mydata/folder:/opt/mydata/:Z
Ansible poses an error - {"changed": false,
>
> Jon
>
> On Tuesday, 16 February 2016 13:24:08 UTC, ishan jain wrote:
>>
>> Hi Jon,
>>
>> Indeed i am using the admin account to connect to the windows machine via
>> ansible. Even when you are logged into the windows machine directly with
>>
it is a single standalone executable with no external
> dependencies (except possibly .net)
> Jon
>
> On Friday, 12 February 2016 09:04:26 UTC, ishan jain wrote:
>>
>> Thanks Joe,
>>
>> I tried using the raw module but the problem i am facing is that NSS
s helps. I have not used mklink though.
>
> Jon
>
>
>
> On Thursday, 11 February 2016 14:47:40 UTC, ishan jain wrote:
>>
>> I am trying to make a lot symbolic links for my directories and files and
>> manually i use mklink command to make them. Oddly enough, this command
o what I do is run the raw module to set that *after* the
> service has been created. For you, this might look something like this:
>
> raw: C:\path\to\nssm.exe set [ServiceName] AppDirectory
> C:\path\to\appdirectory
>
>
> Hope this helps.
>
>
> -Joe
>
> On Thursd
Hi,
I am trying to create some services on my windows machines with the help of
NSSM and would like to automate the process with Ansible. NSSM module for
ansible requires NSSM to be installed on the windows machine but i cannot
do that as internet is disabled on my windows machine. I want to
I am trying to make a lot symbolic links for my directories and files and
manually i use mklink command to make them. Oddly enough, this command
requires admin level privileges to create links.
How can i use mklink via ansible with admin privileges to create symbolic
links ?
--
You received
94 matches
Mail list logo