Re: [ansible-project] ansible --check mode for shift left

2022-09-07 Thread Mike Eggleston
Try a dry run with —check on a remote host (—limit $HOST). I forgot, —check 
does a dry run. 

Mike

> On Sep 7, 2022, at 10:36, Steve Button  wrote:
> 
> Hi,
> 
> I'm trying to add some "shift left" to my Ansible, so that mistakes don't 
> creep in. Firstly, I thought I would run --check (perhaps as a git pre-commit 
> hook or perhaps in Jenkins pipeline eventually). So, I tried it locally. 
> Unfortunately it bombs out in several places, as some tasks are reliant on 
> the output of other tasks. Not a great problem, as I've added 
> 
> when: not ansible_check_mode
> 
> to those tasks. 
> 
> Is there a better way of achieving this? Particularly it would be useful to 
> check that variables are set to something sensible (catch typos or just 
> missed variables) BEFORE it goes into production. We have vars files based on 
> environments, so these don't get checked until we actually deploy to that 
> environment. 
> 
> 
> -- 
> 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/aa334744-9303-42ea-8017-58e2afd52719n%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/35EBBFA5-EB99-4BEC-AABE-B746AF0C681E%40gmail.com.


Re: [ansible-project] ansible --check mode for shift left

2022-09-07 Thread Vladimir Botka
On Wed, 7 Sep 2022 08:36:14 -0700 (PDT)
Steve Button  wrote:

Providing default values for missing outputs might be a better option
in some cases. It would be good to see the particular case(s).


-- 
Vladimir Botka

-- 
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/20220907175904.406218a0%40gmail.com.


pgp0TZWBD1XIW.pgp
Description: OpenPGP digital signature


Re: [ansible-project] ansible --check mode for shift left

2022-09-07 Thread Stephen Maher
Hi Steve,

Take a look at check_mode and assess your playbook to see which features are 
you can safely change, ie those that do not make change.

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

Regards
Steve Maher


> On 7 Sep 2022, at 16:36, Steve Button  wrote:
> 
> Hi,
> 
> I'm trying to add some "shift left" to my Ansible, so that mistakes don't 
> creep in. Firstly, I thought I would run --check (perhaps as a git pre-commit 
> hook or perhaps in Jenkins pipeline eventually). So, I tried it locally. 
> Unfortunately it bombs out in several places, as some tasks are reliant on 
> the output of other tasks. Not a great problem, as I've added 
> 
> when: not ansible_check_mode
> 
> to those tasks. 
> 
> Is there a better way of achieving this? Particularly it would be useful to 
> check that variables are set to something sensible (catch typos or just 
> missed variables) BEFORE it goes into production. We have vars files based on 
> environments, so these don't get checked until we actually deploy to that 
> environment. 
> 
> 
> 
> -- 
> 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/aa334744-9303-42ea-8017-58e2afd52719n%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/9DA8BDE9-D335-4C1D-892E-9A734F7D41BA%40gmail.com.


[ansible-project] ansible --check mode for shift left

2022-09-07 Thread Steve Button
Hi,

I'm trying to add some "shift left" to my Ansible, so that mistakes don't 
creep in. Firstly, I thought I would run --check (perhaps as a git 
pre-commit hook or perhaps in Jenkins pipeline eventually). So, I tried it 
locally. Unfortunately it bombs out in several places, as some tasks are 
reliant on the output of other tasks. Not a great problem, as I've added 

when: not ansible_check_mode

to those tasks. 

Is there a better way of achieving this? Particularly it would be useful to 
check that variables are set to something sensible (catch typos or just 
missed variables) BEFORE it goes into production. We have vars files based 
on environments, so these don't get checked until we actually deploy to 
that environment. 


-- 
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/aa334744-9303-42ea-8017-58e2afd52719n%40googlegroups.com.