[ansible]; working with multiple dictionary











up vote
0
down vote

favorite












I'm trying to run the following ::



Press to see code



   - name: Snapshot BI nodes
hosts: [CLUSTER-BI,CLUSTER-BI-REPLACE]
vars_files:
- snapshot_vars.yml
user: root
any_errors_fatal: true
tasks:

- name: step 1
shell: "{{item.value}} &> {{snapshot_dir}}/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} &> {{snapshot_dir}}/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


getting error after step 1
How do I set a new dic for each step










share|improve this question
























  • Please show the error.
    – Rob Bricheno
    Nov 12 at 16:58










  • There is no error it is just not proceeding to step 2. and if I inverse between them it will do step 2 and not 1.
    – Amir Kourdi
    Nov 12 at 17:03










  • Just a guess, is this related to the use of the ampersand &? What happens if you remove those & characters and try running it? I realise you may want this behaviour, but lets see if the whole thing runs without them first, then work out how to deliver the behaviour you want.
    – Rob Bricheno
    Nov 12 at 17:09












  • I tried to remove it, it does not work.
    – Amir Kourdi
    Nov 12 at 17:56










  • please add the vars ETL and MSTR
    – chenchuk
    Nov 12 at 18:06















up vote
0
down vote

favorite












I'm trying to run the following ::



Press to see code



   - name: Snapshot BI nodes
hosts: [CLUSTER-BI,CLUSTER-BI-REPLACE]
vars_files:
- snapshot_vars.yml
user: root
any_errors_fatal: true
tasks:

- name: step 1
shell: "{{item.value}} &> {{snapshot_dir}}/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} &> {{snapshot_dir}}/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


getting error after step 1
How do I set a new dic for each step










share|improve this question
























  • Please show the error.
    – Rob Bricheno
    Nov 12 at 16:58










  • There is no error it is just not proceeding to step 2. and if I inverse between them it will do step 2 and not 1.
    – Amir Kourdi
    Nov 12 at 17:03










  • Just a guess, is this related to the use of the ampersand &? What happens if you remove those & characters and try running it? I realise you may want this behaviour, but lets see if the whole thing runs without them first, then work out how to deliver the behaviour you want.
    – Rob Bricheno
    Nov 12 at 17:09












  • I tried to remove it, it does not work.
    – Amir Kourdi
    Nov 12 at 17:56










  • please add the vars ETL and MSTR
    – chenchuk
    Nov 12 at 18:06













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to run the following ::



Press to see code



   - name: Snapshot BI nodes
hosts: [CLUSTER-BI,CLUSTER-BI-REPLACE]
vars_files:
- snapshot_vars.yml
user: root
any_errors_fatal: true
tasks:

- name: step 1
shell: "{{item.value}} &> {{snapshot_dir}}/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} &> {{snapshot_dir}}/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


getting error after step 1
How do I set a new dic for each step










share|improve this question















I'm trying to run the following ::



Press to see code



   - name: Snapshot BI nodes
hosts: [CLUSTER-BI,CLUSTER-BI-REPLACE]
vars_files:
- snapshot_vars.yml
user: root
any_errors_fatal: true
tasks:

- name: step 1
shell: "{{item.value}} &> {{snapshot_dir}}/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} &> {{snapshot_dir}}/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


getting error after step 1
How do I set a new dic for each step







python centos ansible ansible-2.x ansible-inventory






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 17:01

























asked Nov 12 at 16:47









Amir Kourdi

63




63












  • Please show the error.
    – Rob Bricheno
    Nov 12 at 16:58










  • There is no error it is just not proceeding to step 2. and if I inverse between them it will do step 2 and not 1.
    – Amir Kourdi
    Nov 12 at 17:03










  • Just a guess, is this related to the use of the ampersand &? What happens if you remove those & characters and try running it? I realise you may want this behaviour, but lets see if the whole thing runs without them first, then work out how to deliver the behaviour you want.
    – Rob Bricheno
    Nov 12 at 17:09












  • I tried to remove it, it does not work.
    – Amir Kourdi
    Nov 12 at 17:56










  • please add the vars ETL and MSTR
    – chenchuk
    Nov 12 at 18:06


















  • Please show the error.
    – Rob Bricheno
    Nov 12 at 16:58










  • There is no error it is just not proceeding to step 2. and if I inverse between them it will do step 2 and not 1.
    – Amir Kourdi
    Nov 12 at 17:03










  • Just a guess, is this related to the use of the ampersand &? What happens if you remove those & characters and try running it? I realise you may want this behaviour, but lets see if the whole thing runs without them first, then work out how to deliver the behaviour you want.
    – Rob Bricheno
    Nov 12 at 17:09












  • I tried to remove it, it does not work.
    – Amir Kourdi
    Nov 12 at 17:56










  • please add the vars ETL and MSTR
    – chenchuk
    Nov 12 at 18:06
















Please show the error.
– Rob Bricheno
Nov 12 at 16:58




Please show the error.
– Rob Bricheno
Nov 12 at 16:58












There is no error it is just not proceeding to step 2. and if I inverse between them it will do step 2 and not 1.
– Amir Kourdi
Nov 12 at 17:03




There is no error it is just not proceeding to step 2. and if I inverse between them it will do step 2 and not 1.
– Amir Kourdi
Nov 12 at 17:03












Just a guess, is this related to the use of the ampersand &? What happens if you remove those & characters and try running it? I realise you may want this behaviour, but lets see if the whole thing runs without them first, then work out how to deliver the behaviour you want.
– Rob Bricheno
Nov 12 at 17:09






Just a guess, is this related to the use of the ampersand &? What happens if you remove those & characters and try running it? I realise you may want this behaviour, but lets see if the whole thing runs without them first, then work out how to deliver the behaviour you want.
– Rob Bricheno
Nov 12 at 17:09














I tried to remove it, it does not work.
– Amir Kourdi
Nov 12 at 17:56




I tried to remove it, it does not work.
– Amir Kourdi
Nov 12 at 17:56












please add the vars ETL and MSTR
– chenchuk
Nov 12 at 18:06




please add the vars ETL and MSTR
– chenchuk
Nov 12 at 18:06












1 Answer
1






active

oldest

votes

















up vote
0
down vote













This works without the & :



---
- name: test
hosts: localhost
vars:
ETL:
file1: "echo hello etl"
file2: "echo hello2 etl"
MSTR:
file3: "echo hello3 mstr"
file4: "echo hello4 mstr"
tasks:
- name: step 1
shell: "{{item.value}} > /tmp/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} > /tmp/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


I end up with 4 files ( the ETL/MSTR folders must exists )



/tmp/ tree
.
├── ETL
│   ├── file1.log
│   └── file2.log
├── MSTR
│   ├── file3.log
│   └── file4.log





share|improve this answer





















  • Thank you! It is working now
    – Amir Kourdi
    Nov 15 at 9:47











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266618%2fansible-working-with-multiple-dictionary%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













This works without the & :



---
- name: test
hosts: localhost
vars:
ETL:
file1: "echo hello etl"
file2: "echo hello2 etl"
MSTR:
file3: "echo hello3 mstr"
file4: "echo hello4 mstr"
tasks:
- name: step 1
shell: "{{item.value}} > /tmp/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} > /tmp/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


I end up with 4 files ( the ETL/MSTR folders must exists )



/tmp/ tree
.
├── ETL
│   ├── file1.log
│   └── file2.log
├── MSTR
│   ├── file3.log
│   └── file4.log





share|improve this answer





















  • Thank you! It is working now
    – Amir Kourdi
    Nov 15 at 9:47















up vote
0
down vote













This works without the & :



---
- name: test
hosts: localhost
vars:
ETL:
file1: "echo hello etl"
file2: "echo hello2 etl"
MSTR:
file3: "echo hello3 mstr"
file4: "echo hello4 mstr"
tasks:
- name: step 1
shell: "{{item.value}} > /tmp/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} > /tmp/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


I end up with 4 files ( the ETL/MSTR folders must exists )



/tmp/ tree
.
├── ETL
│   ├── file1.log
│   └── file2.log
├── MSTR
│   ├── file3.log
│   └── file4.log





share|improve this answer





















  • Thank you! It is working now
    – Amir Kourdi
    Nov 15 at 9:47













up vote
0
down vote










up vote
0
down vote









This works without the & :



---
- name: test
hosts: localhost
vars:
ETL:
file1: "echo hello etl"
file2: "echo hello2 etl"
MSTR:
file3: "echo hello3 mstr"
file4: "echo hello4 mstr"
tasks:
- name: step 1
shell: "{{item.value}} > /tmp/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} > /tmp/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


I end up with 4 files ( the ETL/MSTR folders must exists )



/tmp/ tree
.
├── ETL
│   ├── file1.log
│   └── file2.log
├── MSTR
│   ├── file3.log
│   └── file4.log





share|improve this answer












This works without the & :



---
- name: test
hosts: localhost
vars:
ETL:
file1: "echo hello etl"
file2: "echo hello2 etl"
MSTR:
file3: "echo hello3 mstr"
file4: "echo hello4 mstr"
tasks:
- name: step 1
shell: "{{item.value}} > /tmp/ETL/{{item.key}}.log"
with_dict: "{{ ETL }}"

- name: step 2
shell: "{{item.value}} > /tmp/MSTR/{{item.key}}.log"
with_dict: "{{ MSTR }}"


I end up with 4 files ( the ETL/MSTR folders must exists )



/tmp/ tree
.
├── ETL
│   ├── file1.log
│   └── file2.log
├── MSTR
│   ├── file3.log
│   └── file4.log






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 18:19









chenchuk

1,96231322




1,96231322












  • Thank you! It is working now
    – Amir Kourdi
    Nov 15 at 9:47


















  • Thank you! It is working now
    – Amir Kourdi
    Nov 15 at 9:47
















Thank you! It is working now
– Amir Kourdi
Nov 15 at 9:47




Thank you! It is working now
– Amir Kourdi
Nov 15 at 9:47


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266618%2fansible-working-with-multiple-dictionary%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to pass form data using jquery Ajax to insert data in database?

National Museum of Racing and Hall of Fame

Guess what letter conforming each word