[ansible-project] Running roles for every host mentioned in inventory file

2020-04-30 Thread Vishal Bobade
HI , 

I have my inventory file like below , where I am using the variables 
primaryNode, secondaryNode in the roles so that particular role will run on 
the host specified infront of ansible_host values.

Now, how can i pass multiple hosts in the inventory under secondaryNode so 
that role2 will run on all those nodes one by one. and I will not need to 
create role3 or role 4 for those.


inventory file 


all:
>  children:
>   ha:
>hosts:
> primaryNode:
>   ansible_host: domain.net1
> secondaryNode:
>   ansible_host: domain.net2



my yaml looks liike elow :


2 

3 

4 

5 

6 

7 

8 

9 

10 

11 

12 

13 

14 

15 

16 

17 

18 

19 

20 

21 

22 

23 

24 


 name: Installing primary node  hosts: primaryNode  become: True  roles:
  - role: role1
- name: Installing secondary node  hosts: secondaryNode  become: True  roles:
  - role: role2

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7fca06ae-1861-4685-8582-447b71609814%40googlegroups.com.


[ansible-project] Re: Unable to access variables from host_vars dir however can access the same variables when specified in roles/defaults/mail.yml

2020-03-04 Thread Vishal Bobade
@sagarmujumale - any idea on this?

On Wednesday, March 4, 2020 at 7:19:44 PM UTC+5:30, Vishal Bobade wrote:
>
>
> TASK [ansible-manage-lvm : manage_lvm | creating new LVM volume group(s)] 
> **
>  [0;31mfatal: [grafana]: FAILED! => {"msg": "'config_lv_name' is undefined"} 
> [0m
>  [0;31m [0m
>
>
>
>
>
> I am gettin the above error when I am trying to create and procure lvm 
> stuff on my new environment. I want to mention all the variables as a part 
> of host_vars like below:
>
> # lvm variablesvg_name: "VolGroup01"config_lv_name: "LogVol10"data_lv_name: 
> "LogVol11"lvm_disk_name: "/dev/nvme2n1"config_mntp: "/opt/tools"data_mntp: 
> "/data"config_lv_size: "50G"data_lv_size: "100G"
>
>
>
> I am trying to use them as below :
>
>
> lvm_groups:  - vgname: "{{ vg_name }}"disks:   - "{{ 
> lvm_disk_name }}"create: truelvnames:  - lvname: "{{ 
> config_lv_name }}"size: "{{ config_lv_size }}"create: 
> true  ## Mention "false" in case of lvm removalfilesystem: xfs
> mount: truemntp: "{{ config_mntp }}"  
> - lvname: "LogVol11"size: "{{ data_lv_size }}"create: 
> true  ## Mention "false" in case of lvm removalfilesystem: xfs
> mount: true    mntp: "{{ data_mntp }}"manage_lvm: true
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Wednesday, March 4, 2020 at 7:10:36 PM UTC+5:30, Sagar Mujumale wrote:
>>
>> Whats the problem? where do you stuck. Please post more information.
>>
>> On Wednesday, 4 March 2020 18:54:29 UTC+5:30, Vishal Bobade wrote:
>>>
>>> I have created multiple inventory files specific to dev , qa etc env. 
>>> under inventory dir.
>>>
>>> inventory/dev.domain.net.yml 
>>>
>>> Any suggestions, would help as I am stucked here..
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/35253e9a-06a1-4392-ba40-4747ae755187%40googlegroups.com.


[ansible-project] Re: Unable to access variables from host_vars dir however can access the same variables when specified in roles/defaults/mail.yml

2020-03-04 Thread Vishal Bobade


TASK [ansible-manage-lvm : manage_lvm | creating new LVM volume group(s)] **
 [0;31mfatal: [grafana]: FAILED! => {"msg": "'config_lv_name' is undefined"} [0m
 [0;31m [0m





I am gettin the above error when I am trying to create and procure lvm 
stuff on my new environment. I want to mention all the variables as a part 
of host_vars like below:

# lvm variablesvg_name: "VolGroup01"config_lv_name: "LogVol10"data_lv_name: 
"LogVol11"lvm_disk_name: "/dev/nvme2n1"config_mntp: "/opt/tools"data_mntp: 
"/data"config_lv_size: "50G"data_lv_size: "100G"



I am trying to use them as below :


lvm_groups:  - vgname: "{{ vg_name }}"disks:   - "{{ 
lvm_disk_name }}"create: truelvnames:  - lvname: "{{ 
config_lv_name }}"size: "{{ config_lv_size }}"create: 
true  ## Mention "false" in case of lvm removalfilesystem: xfs  
  mount: truemntp: "{{ config_mntp }}"  - 
lvname: "LogVol11"size: "{{ data_lv_size }}"create: 
true  ## Mention "false" in case of lvm removalfilesystem: xfs  
  mount: truemntp: "{{ data_mntp }}"manage_lvm: true













On Wednesday, March 4, 2020 at 7:10:36 PM UTC+5:30, Sagar Mujumale wrote:
>
> Whats the problem? where do you stuck. Please post more information.
>
> On Wednesday, 4 March 2020 18:54:29 UTC+5:30, Vishal Bobade wrote:
>>
>> I have created multiple inventory files specific to dev , qa etc env. 
>> under inventory dir.
>>
>> inventory/dev.domain.net.yml 
>>
>> Any suggestions, would help as I am stucked here..
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6de80b67-00ce-484b-847d-99c8d850eea3%40googlegroups.com.


[ansible-project] Unable to access variables from host_vars dir however can access the same variables when specified in roles/defaults/mail.yml

2020-03-04 Thread Vishal Bobade
I have created multiple inventory files specific to dev , qa etc env. under 
inventory dir.

inventory/dev.domain.net.yml 

Any suggestions, would help as I am stucked here..


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e31f03f6-d3a3-47a9-82fd-63eb530ea422%40googlegroups.com.


Re: [ansible-project] Facing issue with URI module

2020-03-02 Thread Vishal Bobade
Do u have any reverse proxy configured please check that.

On Mon, 2 Mar, 2020, 5:32 PM Dick Visser,  wrote:

> If you use try with -vvv then you can see the parameters with which
> the module was invoked.
>
> On Mon, 2 Mar 2020 at 12:44, Himanshu Pupneja 
> wrote:
> >
> > I am facing issue in URI module, Could you please help me in this
> > It works well with postman and curl command.
> >
> >
> >
> > Below module is failing
> >
> > =
> >   - name: Connect to website
> > uri:
> >   url: https://xyz.com/api.php
> >   headers:
> > apikey: "xyz1"
> > apitoken: "xyz2
> > cmd: "xyz"
> >   body_format: "form-urlencoded"
> >   body:
> > abc: "123"
> > def: "456"
> >   return_content: yes
> >   validate_certs: no
> >   method: POST
> >   timeout: 60
> >   use_proxy: no
> > 
> >
> > ===Error Output
> >
> > "msg": "Status code was 401 and not [200]: HTTP Error 401: Unauthorized",
> >
> > 
> >
> >
> > Curl - which is working==
> >
> > curl --location --request POST 'https://xyz.com/api.php' \
> >
> > --header 'apikey: xyz' \
> >
> > --header 'apitoken: xyz' \
> >
> > --header 'cmd: xyz' \
> >
> > --data-urlencode 'abc=123' \
> >
> > --data-urlencode 'def=456'
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to ansible-project+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1f433a02-4835-4cc7-a05d-197cf302c6cc%40googlegroups.com
> .
>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNu0iJWNBgT_igHHuec_paupGKO5%2BTDLM5ndhp2oUSv_w%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJWgDib1%2BsR%3DXK4D9ZyrbGS_ykRNA%3DqSFttHd0fbOK3EimExqg%40mail.gmail.com.


[ansible-project] using hosts mentioned in inventory files in my tasks

2020-02-26 Thread Vishal Bobade
Hello ,

I have a inventory file with some 5-6 hosts and I want use them in some of 
my tasks/main.yml  file. Could some one please suggest how can I do that .

Lets say below is my inventory file



[gameday]grafana.domain.netgitlab.domain.netsonarqube.domain.netartifactory.domain.netprometheus.domain.net



I want to use them in some shell script which is going to be run as a part of 
some tasks.


for example below is some script where I want to replace 
"sonarqube.dummy.domain.net" this with the one in inventory file which is 
"sonarqube.domain.net"


*shell script :*


-->

read -p "Enter a server name for Sonarqube : " SQ 

if [ -z "$SQ" ]; then 

 echo "DNS name for sonarqube not provided, cannot proceed" 

 exit 1 

else 

 sed -i s/sonarqube.dummy.domain.net/$SQ/g  /opt/sonarqube/*.json 

fi

<-

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/915a168d-4b8f-4437-80e9-f45cf3af9d35%40googlegroups.com.


Re: [ansible-project] Obfuscate password in the Ansible Vault

2020-02-19 Thread Vishal Bobade
Hi,

Do encrypt your string with ansible-vault encrypt command and assign a
variable to it.

You can use that variable in vars Or defaults dir in any role.



Check below link.

https://docs.ansible.com/ansible/latest/user_guide/vault.html


On Wed, 19 Feb, 2020, 8:51 PM Poemy,  wrote:

> Hi,
>
> My playbook installs Docker on a remote server, and logs in on a docker
> registry by using user credentials, specified by following task
> - name: Log into FIS registry
>   docker_login:
> registry: my-company-docker-registry
> username: my-user-account
> password: my-password-in-plain-text
>
> Now, what I want to achieve is that my password is stored in the ansible
> vault and gets decrypted back from the ansible vault.
> This to have no plain password anymore in my playbook.
> But how do I achieve this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7e116a8b-4fcc-4b80-b02e-0a4bb0b2ce1f%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJWgDibP18-2o%3D%3D%3D7Wsr_UXT9xmdF2h%3DS%3DP4CObwzf%3D9h8vxOw%40mail.gmail.com.


[ansible-project] unable to use a remote node file in uri module

2020-02-13 Thread Vishal Bobade
Hi, 

below is my task where in the "body" section in the below task - I am 
currently using a file and it is throwing error (I actually check the 
location file is present there) when I am trying to run a jenkins job. 

 [1;35m[WARNING]: Unable to find 'include/Browsers-CollectionDB.json' in 
expected paths (use [0m

 [1;35m-v to see paths) [0m
 [1;35m [0m
 [0;31mfatal: [10.181.56.199]: FAILED! => {"msg": "An unhandled exception 
occurred while running the lookup plugin 'file'. Error was a , original message: could not locate file in 
lookup: 'include/Browsers-CollectionDB.json'"} [0



However when I try to actually paste data from the file and specify it in 
"body :" it works.
 

body: "{{ lookup('file','include/Browsers-CollectionDB.json') }}"



- name: Populating browsers collection
uri:
url: 
"http://{{groups['default'][0]}}:8529/_db/collectionDB/_api/document/browsers"
HEADER_Content-Type: "application-type: json"*body: "{{ 
lookup('file','include/Browsers-CollectionDB.json') }}"
*user: "{{ARANGODB_USER}}"
password: "{{ARANGODB_PASS}}"
method: POST
force_basic_auth: yes
status_code: 200

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2f7bb622-a963-454b-a694-a72580b18283%40googlegroups.com.


[ansible-project] Automating LDAP integration of artifactory using ansible

2020-02-11 Thread Vishal Bobade
Hi, 

could some one help me in understanding if the below yaml code can be used 
in ansible-playbook to achieve the automation of LDAP integration.

security:   #Security configuration (LDAP, SAML, Password Policy, ...)
  ldapSettings:   #LDAP server(s) settings
ldap1:   #The unique ID of the LDAP setting
  emailAttribute: email1   #An attribute that can be used to map a 
user's email to a user created automatically by Artifactory
  ldapPoisoningProtection: true   #When set to true (recommended), 
Artifactory will protect against LDAP poisoning by filtering out users 
exposed to vulnerability
  ldapUrl: ldap://myserver:myport/dc=sampledomain,dc=com   #Location of 
the LDAP server in the following format: 
ldap://myserver:myport/dc=sampledomain,dc=com. The URL should include the 
base DN used to search for and/or authenticate users
  search:
managerDn: manager1   #The full DN of a user with permissions that 
allow querying the LDAP server. When working with LDAP Groups, the user 
should have permissions for any extra group attributes such as memberOf
managerPassword: managerpass1   #The password of the user binding 
to the LDAP server when using "search" authentication
searchBase: searchbase1   #The Context name in which to search 
relative to the base DN in the LDAP URL. Multiple search bases may be 
specified separated by a pipe ( | ). This is parameter is optional
searchFilter: searchfilter1   #A filter expression used to search 
for the user DN that is used in LDAP authentication. Possible examples are: 
uid={0}) - this would search for a username match on the uid attribute. 
Authentication using LDAP is performed from the DN found if successful
searchSubTree: true   #When set, enables deep search through the 
sub-tree of the LDAP URL + Search Base
  userDnPattern: userppatt1  #A DN pattern used to log users directly 
in to the LDAP database. This pattern is used to create a DN string for 
"direct" user authentication, and is relative to the base DN in the LDAP 
URL. For example: uid={0},ou=People
  allowUserToAccessProfile: false   #When set, users created after 
logging in using LDAP will be able to access their profile page in 
Artifactory
  autoCreateUser: true   #When set, Artifactory will automatically 
create new users for those who have logged in using LDAP, and assign them 
to the default groups
  enabled: true   #When set, these settings are enabled
Samp

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f9d8e4a5-cb48-4351-9154-ad9329ab7dd0%40googlegroups.com.


Re: [ansible-project] Re: Switch to root user using dzdo

2020-02-10 Thread Vishal Bobade
I would assume that you could run with -vvv and it will show you the
stdout/stderr that indicates the failure in execution.

On Tue, 11 Feb, 2020, 12:55 PM Vishal Bobade, 
wrote:

> Hi,
>
> Seems related to the particular module you are trying to use here.
>
> Could you try performing this manually by ansible i.e. not by using
> playbook with debug mode enabled and see what error u see.
>
>
> On Tue, 11 Feb, 2020, 12:16 AM Poemy,  wrote:
>
>> As requested I commented out the *become_flags*, which gives me the
>> following task:
>>
>> - name: Install needed packages for Docker
>>   yum:
>> name: yum-utils,device-mapper-persistent-data,lvm2
>> state: latest
>>   become: yes
>>   become_method: dzdo
>>
>> And this gives as result the same error
>>
>> fatal: [10.7.201.114]: FAILED! => {"changed": false, "module_stderr": "",
>> "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the
>> exact error", "rc": 1}
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/f1b2b89c-11dc-4470-be3f-6c470136824f%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/f1b2b89c-11dc-4470-be3f-6c470136824f%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJWgDiaUR6PTV8t0chsRJo52evZKB7mcUW7-nyDOsfPHNj-mwg%40mail.gmail.com.


Re: [ansible-project] Re: Switch to root user using dzdo

2020-02-10 Thread Vishal Bobade
Hi,

Seems related to the particular module you are trying to use here.

Could you try performing this manually by ansible i.e. not by using
playbook with debug mode enabled and see what error u see.


On Tue, 11 Feb, 2020, 12:16 AM Poemy,  wrote:

> As requested I commented out the *become_flags*, which gives me the
> following task:
>
> - name: Install needed packages for Docker
>   yum:
> name: yum-utils,device-mapper-persistent-data,lvm2
> state: latest
>   become: yes
>   become_method: dzdo
>
> And this gives as result the same error
>
> fatal: [10.7.201.114]: FAILED! => {"changed": false, "module_stderr": "",
> "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the
> exact error", "rc": 1}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f1b2b89c-11dc-4470-be3f-6c470136824f%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJWgDiY9CMGBqLP7%3D6gyzTukB%2B8cWk-EuxhJOqZ6u4U8DbW-4A%40mail.gmail.com.


Re: [ansible-project] Re: Switch to root user using dzdo

2020-02-10 Thread Vishal Bobade
Hi,

Does it requires become_flags? Could you try commenting out that one.

On Mon, 10 Feb, 2020, 10:10 PM Poemy,  wrote:

> I followed your suggestions, thanks for that.
>
> I have now following task:
> - name: Install needed packages for Docker
>   yum:
> name: yum-utils,device-mapper-persistent-data,lvm2
> state: latest
>   become: yes
>   become_method: dzdo
>   become_flags: 'su -'
>
> When I run my playbook, it fails with following error message.
> fatal: [10.7.201.114]: FAILED! => {"changed": false, "module_stderr": "",
> "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the
> exact error", "rc": 1}
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0857d7f6-7aa9-4c17-8064-5c4b2ca2e858%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJWgDiaPsk5n3WqtF%2Bq0KEK3W1osYuEchtUK7-WRZRXcXye%2Bhg%40mail.gmail.com.


Re: [ansible-project] Switch to root user using dzdo

2020-02-09 Thread Vishal Bobade
Hi,

Could you try this, before you want the task done with dzdo previleges.

become: yes
become_method: dzdo

On Fri, 7 Feb, 2020, 4:15 PM Poemy,  wrote:

> I have an ansible playblook running some tasks for my user, which I log in
> through ssh.
>
> The user has root privileges by running following command in the terminal:
> dzdo su -
>
> It's actually the only way (no sudo, no root password) to get root access.
>
> Now, what I want to do is to switch my user to root at a certain point in
> my ansible-playbook, using this *dzdo su -* behavior.
>
> How to do this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/41a24067-fa62-4224-b3aa-41b6070bccdc%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJWgDiZYhJTaT-0PEQH7QXJWRxRCUmEHsLe5dPP5EkMy98Rs5A%40mail.gmail.com.


[ansible-project] error while deploying docker-ce using ansible

2020-02-03 Thread Vishal Bobade
Hi, 


I am facing below error while running ansible role in my environment. could 
some one quide me how can I fix this.

TASK [docker_base : Install docker-ce] *

 [0;31mfatal: [10.181.56.199]: FAILED! => {"changed": false, "msg": "Failure 
talking to yum: Could not contact any CDS load balancers: 
rhui2-cds01.us-east-1.aws.ce.redhat.com, 
rhui2-cds02.us-east-1.aws.ce.redhat.com."} [0m

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/85759a82-1165-4016-9005-84fc23ec6944%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-02-02 Thread Vishal Bobade
I tried the above what Kai suggested however that is not working and unable 
to get the particular json for me from the specific backup dir. However I 
could find a way to get this done  as shown below - this way we can get the 
output from the variable line by line.

 with_items:
- "{{ dashboards_imported_from_latest_backup.stdout_lines[2] }}"
- "{{ dashboards_imported_from_latest_backup.stdout_lines[3] }}"
- "{{ dashboards_imported_from_latest_backup.stdout_lines[4] }}"



On Monday, February 3, 2020 at 10:22:42 AM UTC+5:30, Vishal Bobade wrote:
>
> Thanks Kai. No actually this is not going to be one item only as it should 
> be done for almost 7-8 json files. so i think the below trick you shown I 
> am going to try that right now and see if that works forme. Thanks again , 
> cheers!
>
> On Saturday, February 1, 2020 at 1:42:41 PM UTC+5:30, Kai Stian Olstad 
> wrote:
>>
>> On 01.02.2020 06:55, Vishal Bobade wrote: 
>> > trying like this 
>> > 
>> >  with_items: 
>> > - "{{ dashboards_imported_from_latest_backup ~ 
>> > '/Artifactory_Monitoring.json' }}" 
>> > 
>> > 
>> > 
>> > On Saturday, February 1, 2020 at 11:24:05 AM UTC+5:30, Vishal Bobade 
>> > wrote: 
>> >> 
>> >> HI kai, 
>> >> 
>> >> thanks for the response. however I am trying to use inside looping 
>> >> with_items it isn't working. 
>> >> 
>> >>  "msg": "error : Can't load json file [Errno 2] No such file or 
>> >> directory: 
>> >> '{\\'stderr_lines\\': 
>>
>> This will only be one item so you don't need to use with_items. 
>> Anyway, since you only need the text it should be like this 
>>
>>   with_items: 
>> - "{{ 
>> dashboards_imported_from_latest_backup}}/Artifactory_Monitoring.json" 
>>
>>
>> -- 
>> Kai Stian Olstad 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/9551db5a-8eba-41b6-a667-893b2d3fa184%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-02-02 Thread Vishal Bobade
Thanks Kai. No actually this is not going to be one item only as it should 
be done for almost 7-8 json files. so i think the below trick you shown I 
am going to try that right now and see if that works forme. Thanks again , 
cheers!

On Saturday, February 1, 2020 at 1:42:41 PM UTC+5:30, Kai Stian Olstad 
wrote:
>
> On 01.02.2020 06:55, Vishal Bobade wrote: 
> > trying like this 
> > 
> >  with_items: 
> > - "{{ dashboards_imported_from_latest_backup ~ 
> > '/Artifactory_Monitoring.json' }}" 
> > 
> > 
> > 
> > On Saturday, February 1, 2020 at 11:24:05 AM UTC+5:30, Vishal Bobade 
> > wrote: 
> >> 
> >> HI kai, 
> >> 
> >> thanks for the response. however I am trying to use inside looping 
> >> with_items it isn't working. 
> >> 
> >>  "msg": "error : Can't load json file [Errno 2] No such file or 
> >> directory: 
> >> '{\\'stderr_lines\\': 
>
> This will only be one item so you don't need to use with_items. 
> Anyway, since you only need the text it should be like this 
>
>   with_items: 
> - "{{ 
> dashboards_imported_from_latest_backup}}/Artifactory_Monitoring.json" 
>
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5f16b78d-d1b6-4bbe-8f97-a6c1469b7abd%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade

trying like this 

 with_items:
- "{{ dashboards_imported_from_latest_backup ~ 
'/Artifactory_Monitoring.json' }}"



On Saturday, February 1, 2020 at 11:24:05 AM UTC+5:30, Vishal Bobade wrote:
>
> HI kai,
>
> thanks for the response. however I am trying to use inside looping 
> with_items it isn't working.
>
>  "msg": "error : Can't load json file [Errno 2] No such file or directory: 
> '{\\'stderr_lines\\':
>
>
>
> On Saturday, February 1, 2020 at 12:57:57 AM UTC+5:30, Kai Stian Olstad 
> wrote:
>>
>> On 31.01.2020 18:17, Vishal Bobade wrote: 
>> > *Is it possible to concatenate like below?* 
>> > 
>> > - name: Retaining latest backup directory 
>> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
>> > |tail -1 
>> >   register: import_back_up_dir 
>> > 
>> > - name: Import dashboard 
>> >   grafana_dashboard: 
>> > state: present 
>> > message: Updated by ansible 
>> > overwrite: no 
>> > path: "{{ item }}" 
>> >   with_items: 
>> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json" 
>> > *>>>>>> I am trying to concatenate like this however this is not 
>> > working - 
>> > could some one please suggest how can we achieve this concatenation.* 
>>
>> Concatenate need to be done in inside of {{ }} and use tilde 
>>
>> "{{ import_back_up_dir ~ 'SonarQube_Dashboard.json' }}" 
>>
>> -- 
>> Kai Stian Olstad 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a65c6e22-ba85-4873-978d-0a5710ee4002%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
HI kai,

thanks for the response. however I am trying to use inside looping 
with_items it isn't working.

 "msg": "error : Can't load json file [Errno 2] No such file or directory: 
'{\\'stderr_lines\\':



On Saturday, February 1, 2020 at 12:57:57 AM UTC+5:30, Kai Stian Olstad 
wrote:
>
> On 31.01.2020 18:17, Vishal Bobade wrote: 
> > *Is it possible to concatenate like below?* 
> > 
> > - name: Retaining latest backup directory 
> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
> > |tail -1 
> >   register: import_back_up_dir 
> > 
> > - name: Import dashboard 
> >   grafana_dashboard: 
> > state: present 
> > message: Updated by ansible 
> > overwrite: no 
> > path: "{{ item }}" 
> >   with_items: 
> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json" 
> > *>>>>>> I am trying to concatenate like this however this is not 
> > working - 
> > could some one please suggest how can we achieve this concatenation.* 
>
> Concatenate need to be done in inside of {{ }} and use tilde 
>
> "{{ import_back_up_dir ~ 'SonarQube_Dashboard.json' }}" 
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6287a30e-8a13-45a7-8a15-453b2aa38839%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
Thanks Stefan for looking into this. actually I want to import some grafana 
dashboards and I need to map this import_back_up_dir (which I cannot 
hardcode) to appropriate json files. so I want to find a way to concatenate 
these.

On Friday, January 31, 2020 at 11:56:45 PM UTC+5:30, Vishal Bobade wrote:
>
> Replied
>
> On Friday, January 31, 2020 at 11:07:36 PM UTC+5:30, Stefan Hornburg 
> (Racke) wrote:
>>
>> On 1/31/20 6:17 PM, Vishal Bobade wrote: 
>> > *_Is it possible to concatenate like below?_* 
>> > 
>> > - name: Retaining latest backup directory  
>> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
>> |tail -1 
>> >   register: import_back_up_dir 
>> > 
>> > - name: Import dashboard 
>> >   grafana_dashboard: 
>> > state: present 
>> > message: Updated by ansible 
>> > overwrite: no 
>> > path: "{{ item }}" 
>> >   with_items: 
>> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"  
>>   _>>>>>> I am trying to concatenate like this however 
>> > this is not working - could some one please suggest how can we achieve 
>> this concatenation. 
>>
>> Maybe you give us the objective of your task first ... 
>>
>> Regards 
>>  Racke 
>> > _ 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups "Ansible Project" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to 
>> > ansible...@googlegroups.com > ansible-project+unsubscr...@googlegroups.com>. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com
>>  
>> > <
>> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com?utm_medium=email_source=footer>.
>>  
>>
>>
>>
>> -- 
>> Ecommerce and Linux consulting + Perl and web application programming. 
>> Debian and Sympa administration. Provisioning with Ansible. 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d8605c75-f314-49a2-9545-713edecad681%40googlegroups.com.


Re: [ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
Replied

On Friday, January 31, 2020 at 11:07:36 PM UTC+5:30, Stefan Hornburg 
(Racke) wrote:
>
> On 1/31/20 6:17 PM, Vishal Bobade wrote: 
> > *_Is it possible to concatenate like below?_* 
> > 
> > - name: Retaining latest backup directory  
> >   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; 
> |tail -1 
> >   register: import_back_up_dir 
> > 
> > - name: Import dashboard 
> >   grafana_dashboard: 
> > state: present 
> > message: Updated by ansible 
> > overwrite: no 
> > path: "{{ item }}" 
> >   with_items: 
> >  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"  
>   _>>>>>> I am trying to concatenate like this however 
> > this is not working - could some one please suggest how can we achieve 
> this concatenation. 
>
> Maybe you give us the objective of your task first ... 
>
> Regards 
>  Racke 
> > _ 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Ansible Project" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to 
> > ansible...@googlegroups.com   ansible-project+unsubscr...@googlegroups.com >. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming. 
> Debian and Sympa administration. Provisioning with Ansible. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e34eeb4d-c95d-4995-b5aa-2aea4143249c%40googlegroups.com.


[ansible-project] Re: Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
Thanks Stefan for looking into this. actually I want to import some grafana 
dashboards and I need to map this import_back_up_dir (which I cannot 
hardcode) to appropriate json files. so I want to find a way to concatenate 
these.





On Friday, January 31, 2020 at 10:47:01 PM UTC+5:30, Vishal Bobade wrote:
>
> *Is it possible to concatenate like below?*
>
> - name: Retaining latest backup directory 
>   shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; |tail 
> -1
>   register: import_back_up_dir
>
> - name: Import dashboard
>   grafana_dashboard:
> state: present
> message: Updated by ansible
> overwrite: no
> path: "{{ item }}"
>   with_items:
>  - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"
> *>>>>>> I am trying to concatenate like this however this is not working - 
> could some one please suggest how can we achieve this concatenation.*
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/abecac3f-691a-44ee-b15f-cf3a1ff7d603%40googlegroups.com.


[ansible-project] Concatenate variable and string in looping with_items

2020-01-31 Thread Vishal Bobade
*Is it possible to concatenate like below?*

- name: Retaining latest backup directory 
  shell:  find $(pwd)/*backup* -type d -prune -exec ls -d {} \; |tail -1
  register: import_back_up_dir

- name: Import dashboard
  grafana_dashboard:
state: present
message: Updated by ansible
overwrite: no
path: "{{ item }}"
  with_items:
 - "{{ import_back_up_dir }} + SonarQube_Dashboard.json"
*>> I am trying to concatenate like this however this is not working - 
could some one please suggest how can we achieve this concatenation.*

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/98f66710-6fc0-4b1f-afdf-6190afab69c2%40googlegroups.com.


[ansible-project] exporting grafana dashboards (containerised) using ansible

2020-01-27 Thread Vishal Bobade
Hello,

I am looking forward to export grafana json dashboards using ansible. Could 
you please help me on how can I use dockerized grafana to do so .

Regards,
vbob

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eefc0323-2cca-4c54-afb1-e4f4ca9b3cc8%40googlegroups.com.