[ansible-project] Re: Looking for global level equivalent of 'inventory_dir' with Ansible 2.4 onwards

2019-05-16 Thread ishan jain
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.

[ansible-project] inventory_dir is still present as a global variable in Ansible 2.4 ?

2018-03-07 Thread ishan jain
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

Re: [ansible-project] pretty printing 'complete' dictionary vars in a file after reading from a list of dicts

2018-02-28 Thread ishan jain
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

Re: [ansible-project] pretty printing 'complete' dictionary vars in a file after reading from a list of dicts

2018-02-27 Thread ishan jain
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

Re: [ansible-project] pretty printing 'complete' dictionary vars in a file after reading from a list of dicts

2018-02-27 Thread ishan jain
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

[ansible-project] pretty printing 'complete' dictionary vars in a file after reading from a list of dicts

2018-02-27 Thread ishan jain
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

Re: [ansible-project] [Ansible 2.4] include_tasks and import_tasks picking the first specified file in a ternary condition

2018-02-20 Thread ishan jain
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, >

[ansible-project] [Ansible 2.4] include_tasks and import_tasks picking the first specified file in a ternary condition

2018-02-19 Thread ishan jain
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: -

[ansible-project] Looking for global level equivalent of 'inventory_dir' with Ansible 2.4 onwards

2017-11-21 Thread ishan jain
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

[ansible-project] Specifying a default value to a dictionary element when the dictionary variable does not exist

2017-10-27 Thread ishan jain
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"

[ansible-project] Out of scope variable in jinja2 template started throwing error after i updated to jinja2 2.9

2017-10-02 Thread ishan jain
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 {%

Re: [ansible-project] Ansible fails to execute a playbook when the value for 'hosts' is defined somewhere in inventory

2017-07-12 Thread ishan jain
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

[ansible-project] Ansible fails to execute a playbook when the value for 'hosts' is defined somewhere in inventory

2017-07-11 Thread ishan jain
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

[ansible-project] Is there a difference in specifying hosts as a list vs specifying hosts as comma separated list in playbooks ?

2017-07-03 Thread ishan jain
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

[ansible-project] How can i load a vars file in inventory which "prepares" a large number of variables via jinja2 expressions ?

2017-06-30 Thread ishan jain
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

[ansible-project] Ansible docker_container task cannot start a container while the equivalent docker run command can

2017-06-22 Thread ishan jain
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,

Re: [ansible-project] How can load an inventory file via a task within a playbook

2017-06-21 Thread ishan jain
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

Re: [ansible-project] How can load an inventory file via a task within a playbook

2017-06-20 Thread ishan jain
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

[ansible-project] How can load an inventory file via a task within a playbook

2017-06-20 Thread ishan jain
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

[ansible-project] Ansible waits for async task to complete for non-zero poll value - Intended behavior or some problem here ?

2017-06-20 Thread ishan jain
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

[ansible-project] Declarative pipeline - How can i use multiple agents within a stage executing in a sequence ?

2017-05-03 Thread ishan jain
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

[ansible-project] can i use variable to specify the agent label in my declarative pipeline ?

2017-05-03 Thread ishan jain
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

[ansible-project] Setup up SSH key in Ansible tower

2017-04-28 Thread ishan jain
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

Re: [ansible-project] Ansible host level interceptors

2017-04-18 Thread ishan jain
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 >

[ansible-project] Ansible host level interceptors

2017-04-13 Thread ishan jain
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

[ansible-project] 'force_kill: true' option in docker_container is unable to kill the container while killing it via the docker daemon (-f option) works fine

2017-03-17 Thread ishan jain
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

[ansible-project] Can i provide options for a module via a dict variable ?

2017-03-14 Thread ishan jain
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: -

Re: [ansible-project] Unable to union another list to a list variable

2017-03-14 Thread ishan jain
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,

[ansible-project] Unable to union another list to a list variable

2017-03-13 Thread ishan jain
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:

[ansible-project] Ansible 2.2.0.0 does not have problems with tab spaces within playbooks ?

2017-03-02 Thread ishan jain
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

[ansible-project] Re: Ansible and Jenkins integration

2017-03-02 Thread ishan jain
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! > >

[ansible-project] How to automatically handle slight difference in configuring Master-slave setup

2017-03-02 Thread ishan jain
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

[ansible-project] Re: How can tell my docker_container module to always pull an Image only sometimes when i specify using extra vars or something

2016-12-05 Thread ishan jain
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

[ansible-project] How can tell my docker_container module to always pull an Image only sometimes when i specify using extra vars or something

2016-11-30 Thread ishan jain
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

[ansible-project] How can i specify the same target host twice or more in my playbook ?

2016-10-26 Thread ishan jain
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.

[ansible-project] Unable to pass the value for a variable in included playbook via another variable in the calling playbook

2016-10-24 Thread ishan jain
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:

[ansible-project] How can i include other var files in a yaml file with only variables defined

2016-10-24 Thread ishan jain
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

[ansible-project] Re: How can i push locally created branch on a repository to origin via Ansible

2016-10-05 Thread ishan jain
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: &

[ansible-project] How can i push locally created branch on a repository to origin via Ansible

2016-10-04 Thread ishan jain
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

Re: [ansible-project] How to access a certain element of a register variable in a loop

2016-09-27 Thread ishan jain
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 >

Re: [ansible-project] How can i get the value from a dict of dicts when the key is supplied by a variable ?

2016-09-15 Thread ishan jain
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

[ansible-project] How can i get the value from a dict of dicts when the key is supplied by a variable ?

2016-09-13 Thread ishan jain
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:* *

[ansible-project] How can i override variable value only for a host via extra-vars supplied through command line

2016-09-05 Thread ishan jain
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

[ansible-project] Re: Ansible installed from yum is unable to connect to windows while Ansible installed via source file is working fine from the same host

2016-09-02 Thread ishan jain
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: >&

[ansible-project] Ansible installed from yum is unable to connect to windows while Ansible installed via source file is working fine from the same host

2016-09-01 Thread ishan jain
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

[ansible-project] Re: Always append a '/' to variable whose value is supplied as extra vars

2016-08-31 Thread ishan jain
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

[ansible-project] Always append a '/' to variable whose value is supplied as extra vars

2016-08-29 Thread ishan jain
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

[ansible-project] Vars defined in host file not getting the value when the value is supplied as extra vars during playbook run

2016-08-29 Thread ishan jain
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

Re: [ansible-project] Can i use variables as values to variables defined in inventory file

2016-08-29 Thread ishan jain
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

[ansible-project] Ansible 2.1.0 docker_container module not pulling image when missing on remote host

2016-08-24 Thread ishan jain
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:

[ansible-project] Can i use variables as values to variables defined in inventory file

2016-08-17 Thread ishan jain
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

Re: [ansible-project] How to check for each value in a list that if the value exists somewhere in another using jinja2 templates

2016-08-06 Thread ishan jain
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?

[ansible-project] How to check for each value in a list that if the value exists somewhere in another using jinja2 templates

2016-08-05 Thread ishan jain
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

Re: [ansible-project] What do you prefer for your components - Roles or playbooks ?

2016-08-03 Thread ishan jain
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

[ansible-project] What do you prefer for your components - Roles or playbooks ?

2016-08-03 Thread ishan jain
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

Re: [ansible-project] Has anyone used Ansible to generate a kind of report about certain checks on remote hosts ?

2016-08-03 Thread ishan jain
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

[ansible-project] Re: How to check if the current user has write access to a given path ?

2016-08-01 Thread ishan jain
.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

[ansible-project] Re: No epoch or seconds in windows facts ? How can i generate unique strings ?

2016-08-01 Thread ishan jain
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

[ansible-project] how to compare two dates (possibly in different format) in jinja2 templates ?

2016-07-28 Thread ishan jain
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 -

[ansible-project] No epoch or seconds in windows facts ? How can i generate unique strings ?

2016-07-28 Thread ishan jain
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":

[ansible-project] How to check if the current user has write access to a given path ?

2016-07-28 Thread ishan jain
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

Re: [ansible-project] Has anyone used Ansible to generate a kind of report about certain checks on remote hosts ?

2016-07-21 Thread ishan jain
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

[ansible-project] Has anyone used Ansible to generate a kind of report about certain checks on remote hosts ?

2016-07-21 Thread ishan jain
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

[ansible-project] Re: How can i get the amount of free space (numerical value) in a logical disk drive in windows server 2012 R2

2016-07-14 Thread ishan jain
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

[ansible-project] How can i get the amount of free space (numerical value) in a logical disk drive in windows server 2012 R2

2016-07-13 Thread ishan jain
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:

[ansible-project] Template module converting CRLF line endings to LF type on its own

2016-06-09 Thread ishan jain
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

[ansible-project] percentage sign in raw command

2016-06-03 Thread ishan jain
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

[ansible-project] Re: Ansible still able to connect to windows host even after the certificates has expired

2016-04-25 Thread ishan jain
(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

[ansible-project] Re: Ansible still able to connect to windows host even after the certificates has expired

2016-04-22 Thread ishan jain
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/

[ansible-project] Ansible still able to connect to windows host even after the certificates has expired

2016-04-22 Thread ishan jain
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

[ansible-project] Re: Playbook over powershell

2016-04-06 Thread ishan jain
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

[ansible-project] Re: How can i specify --rm with Docker run command to make sure the containers are cleaned up on exit ?

2016-04-04 Thread ishan jain
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

[ansible-project] Re: ansible hosts and hosts_vars usage

2016-04-01 Thread ishan jain
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

[ansible-project] How can i specify --rm with Docker run command to make sure the containers are cleaned up on exit ?

2016-03-30 Thread ishan jain
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

[ansible-project] Check the docker container status

2016-03-26 Thread ishan jain
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

[ansible-project] Re: win_stat poses an error when i try to get info about a file symbolic link actively in use by a processor

2016-03-22 Thread ishan jain
; 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: >> >>

[ansible-project] win_stat poses an error when i try to get info about a file symbolic link actively in use by a processor

2016-03-20 Thread ishan jain
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

[ansible-project] Re: Check existence and state of a service on windows machine using win_service

2016-03-20 Thread ishan jain
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

[ansible-project] Re: check if a (file or directory) symbolic links exists on a windows file system with the help of win_file

2016-03-19 Thread ishan jain
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

[ansible-project] Check existence and state of a service on windows machine using win_service

2016-03-19 Thread ishan jain
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:

[ansible-project] Re: win_file module unable to delete directory symbolic links present inside a target dir

2016-03-19 Thread ishan jain
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"

[ansible-project] Re: Check existence and state of a service on windows machine using win_service

2016-03-18 Thread ishan jain
> > 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

[ansible-project] Re: check if a (file or directory) symbolic links exists on a windows file system with the help of win_file

2016-03-16 Thread ishan jain
"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

[ansible-project] check if a (file or directory) symbolic links exists on a windows file system with the help of win_file

2016-03-16 Thread ishan jain
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

[ansible-project] win_file module unable to delete directory symbolic links present inside a target dir

2016-03-08 Thread ishan jain
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

[ansible-project] Line breaks are excluded when copying a file from ansible linux host to windows server using win_copy

2016-03-03 Thread ishan jain
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

[ansible-project] Re: Ansible docker module does not allow me to use bind mode :Z

2016-03-02 Thread ishan jain
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

[ansible-project] Ansible docker module does not allow me to use bind mode :Z

2016-02-29 Thread ishan jain
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,

[ansible-project] Re: Running NSSM from copied executables on windows and avoid installing NSSM

2016-02-18 Thread ishan jain
> > 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 >>

[ansible-project] Re: Running NSSM from copied executables on windows and avoid installing NSSM

2016-02-16 Thread ishan jain
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

[ansible-project] Re: How to make symbolic links in windows via Ansible ?

2016-02-12 Thread ishan jain
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

[ansible-project] Re: Running NSSM from copied executables on windows and avoid installing NSSM

2016-02-12 Thread ishan jain
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

[ansible-project] Running NSSM from copied executables on windows and avoid installing NSSM

2016-02-11 Thread ishan jain
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

[ansible-project] How to make symbolic links in windows via Ansible ?

2016-02-11 Thread ishan jain
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