[ansible-project] Re: ansible-pull git failures on initial clone and when repo changes.
On Sunday, 31 January 2016 10:52:40 UTC, Matt Willsher wrote: > > Hi, > > I'm working with ansible-pull on ansible 2.0.0.2. On initial clone I get > a failure on the first run. Subsequent runs are fine until the content of > the git repo changes, in which case a further error is thrown. Runs when > the repo doesn't change work ok, except for a warning about the user of > sudo, which isn't configured. > > Specifying -i localhost on pull solved the issue. Is appears that the default inventory contains localhost and 127.0.0.1 among others. The same affect is achieved by adding localhost to /etc/ansible/hosts, which also gets rid of a host warning during the ansible run. /usr/bin/ansible-pull -d /var/lib/ansible-local -U https://github.com/mattwillsher/turbo-telegram.git -i localhost -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e5c6f7a9-8865-4758-a655-dddc27652885%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] ansible-pull git failures on initial clone and when repo changes.
Hi, I'm working with ansible-pull on ansible 2.0.0.2. On initial clone I get a failure on the first run. Subsequent runs are fine until the content of the git repo changes, in which case a further error is thrown. Runs when the repo doesn't change work ok, except for a warning about the user of sudo, which isn't configured. Using /etc/ansible/ansible.cfg as config file Starting Ansible Pull at 2016-01-31 10:34:46 /usr/bin/ansible-pull -d /var/lib/ansible-local -U https://github.com/mattwillsher/turbo-telegram.git - EXEC: /usr/bin/ansible -i "/etc/ansible/hosts" -c local - -m git -a "name=https://github.com/mattwillsher/turbo-telegram.git dest=/var/lib/ansible-local depth=1" "localhost,testvm2,testvm2.localdomain,127.0.0.1" Using /etc/ansible/ansible.cfg as config file Loaded callback minimal of type stdout, v2.0 ESTABLISH LOCAL CONNECTION FOR USER: root 127.0.0.1 EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1454236486.6-237992076205449 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1454236486.6-237992076205449 )" ) ESTABLISH LOCAL CONNECTION FOR USER: root 127.0.0.1 EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1454236486.61-229596896503320 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1454236486.61-229596896503320 )" ) 127.0.0.1 PUT /tmp/tmppqj3FG TO /root/.ansible/tmp/ansible-tmp-1454236486.6-237992076205449/git 127.0.0.1 PUT /tmp/tmpzx6CKh TO /root/.ansible/tmp/ansible-tmp-1454236486.61-229596896503320/git 127.0.0.1 EXEC LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1454236486.6-237992076205449/git; rm -rf "/root/.ansible/tmp/ansible-tmp-1454236486.6-237992076205449/" > /dev/null 2>&1 127.0.0.1 EXEC LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1454236486.61-229596896503320/git; rm -rf "/root/.ansible/tmp/ansible-tmp-1454236486.61-229596896503320/" > /dev/null 2>&1 localhost | FAILED! => { "changed": false, "cmd": "/usr/bin/git clone --origin origin --depth 1 https://github.com/mattwillsher/turbo-telegram.git /var/lib/ansible-local", "failed": true, "invocation": { "module_args": { "accept_hostkey": false, "bare": false, "clone": true, "depth": 1, "dest": "/var/lib/ansible-local", "executable": null, "force": false, "key_file": null, "name": "https://github.com/mattwillsher/turbo-telegram.git";, "recursive": true, "reference": null, "refspec": null, "remote": "origin", "repo": "https://github.com/mattwillsher/turbo-telegram.git";, "ssh_opts": null, "track_submodules": false, "update": true, "verify_commit": false, "version": "HEAD" }, "module_name": "git" }, "msg": "fatal: destination path '/var/lib/ansible-local' already exists and is not an empty directory.", "rc": 128, "stderr": "fatal: destination path '/var/lib/ansible-local' already exists and is not an empty directory.\n", "stdout": "", "stdout_lines": [] } 127.0.0.1 | SUCCESS => { "after": "557a71b6a360ec20cf27460115ff670bff070cda", "before": null, "changed": true, "invocation": { "module_args": { "accept_hostkey": false, "bare": false, "clone": true, "depth": 1, "dest": "/var/lib/ansible-local", "executable": null, "force": false, "key_file": null, "name": "https://github.com/mattwillsher/turbo-telegram.git";, "recursive": true, "reference": null, "refspec": null, "remote": "origin", "repo": "https://github.com/mattwillsher/turbo-telegram.git";, "ssh_opts": null, "track_submodules": false, "update": true, "verify_commit": false, "version": "HEAD" }, "module_name": "git" } } Run after update: Using /etc/ansible/ansible.cfg as config file Starting Ansible Pull at 2016-01-31 10:50:15 /usr/bin/ansible-pull -d /var/lib/ansible-local -U https://github.com/mattwillsher/turbo-telegram.git - EXEC: /usr/bin/ansible -i "/etc/ansible/hosts" -c local - -m git -a "name=https://github.com/mattwillsher/turbo-telegram.git dest=/var/lib/ansible-local depth=1" "localhost,testvm2,testvm2.localdomain,127.0.0.1" Using /etc/ansible/ansible.cfg as config file Loaded callback minimal of type stdout, v2.0 ESTABLISH LOCAL CONNECTION FOR USER: root 127.0.0.1 EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1454237415.87-253538956035650 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1454237415.87-253538956035650 )" ) ESTA
[ansible-project] Run a role once and only once
Hi, I have a role that's called from other roles via dependencies. I'm seeing the role run twice, as discussed at https://groups.google.com/forum/#!searchin/ansible-project/role$20dependencies$20run$20twice/ansible-project/qoC1fVKEm7I/MWDl9ALo-KoJ I've worked around this by adding the following as the last task of the role: - set_fact: myrole_has_run=true when: myrole_has_run is not defined And then in the meta/defaults.yml: dependencies: - role: myrole when: myrole_has_run is not defined Is there a native way of making sure a role only runs once? Thanks. Matt -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9f49e409-a9e3-431d-a418-35ef173db679%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Ansible Galaxy OS missing platforms metadata support for FreeBSD 10.x
Hi, FreeBSD 10.x is missing from the support platforms metadata over on Galaxy. Can 10 and 10.1 be added please? Thanks, Matt -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3570e78f-144d-445c-a8c1-82d028f20625%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] include_vars for defaults
In the docs on precedence, discovered facts come under inventory but the include_vars facts are actually higher precedence than the inventory. Being able to have a default_vars module would, I maintain, be a boon for reusable roles. They can be less opinionated and fit more circumstances. It allows for user control while not requiring configuration from the end user for the role to work. Is it something I could implement as a module for my own use or is the variable registration more ingrained than that? Thanks for your time, Matt On 29 Apr 2014 16:49, "Michael DeHaan" wrote: > these variables are facts -- they override inventory variables because > they are at the same depth and are loaded later > > > > > > > On Tue, Apr 29, 2014 at 10:05 AM, Matt Willsher wrote: > >> >> Testing on 1.5.5 they appear at the level of "most everything else" - a >> variable defined in a include_vars file overrides an inventory variable. If >> they were at the level of facts, that would be great and would all default >> like behaviour and overriding by more environment specific data. >> >> >> On 29 April 2014 13:32, Michael DeHaan wrote: >> >>> include_vars creates fact scoped variables. >>> >>> Sorry, you're not going to be able to get it to work every which sort of >>> different way. >>> >>> I would not assume OS specific defaults *or* instead just put hosts in a >>> group based on the OS, if you really need that capability, and then could >>> use group_vars/ files to do this. >>> >>> >>> >>> >>> On Tue, Apr 29, 2014 at 3:05 AM, Matt Willsher wrote: >>> >>>> I'd like the included vars injected with the same precedence as those >>>> in defaults/main.yml rather than the precedence of vars/main.yml. The >>>> documentation is not clear on the what precendence include_vars get. >>>> >>>> From my testing, vars coming from include_vars have a higher precedence >>>> than inventory vars so they can not be overridden by inventory vars. >>>> >>>> Taking: >>>> >>>> >>>> 1. -e variables always win >>>> 2. then comes "most everything else" >>>> 3. then comes variables defined in inventory >>>> 4. then comes facts discovered about a system >>>> 5. then "role defaults", which are the most "defaulty" and lose in >>>> priority to everything. >>>> >>>> I'd like the included vars to have the precedence of 5, rather than 2 >>>> >>>> >>>> On 29 Apr 2014 00:55, "Michael DeHaan" wrote: >>>> >>>> > >>>> > I'm a little confused by this because you seem to be saying a feature >>>> isn't supported that is actually part of Ansible, but it's actually a >>>> module already in Ansible: >>>> > >>>> > http://docs.ansible.com/include_vars_module.html >>>> > >>>> > It also works with the "when" operator for per-OS variant usage. >>>> > >>>> > Were you perhaps reading an old thread talking about a language >>>> feature when it didn't exist? >>>> > >>>> > Sorry for confusion... >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > On Mon, Apr 28, 2014 at 6:01 PM, Matt Willsher >>>> wrote: >>>> >> >>>> >> Hi, >>>> >> >>>> >> I'm trying to write generic roles for particular applications and >>>> keep hitting across the same problem: >>>> >> >>>> >> I want to set role default based on the operating system or other >>>> facts, like include_vars, but this doesn't appear to be supported. >>>> >> >>>> >> The only option I see practically available for template is to use >>>> the template logic to handle defaults, but that, while flexible, is not as >>>> elegant as being able to set by-fact defaults. >>>> >> >>>> >> The code I'm working at present on is >>>> https://github.com/WillsherPartners/ansible-sshd , where there is a >>>> large set of defaults and a template. sshd_subsystem_sftp varies depending >>>> on OS, but I still want to give the person using the role to option to >>>> overrid
Re: [ansible-project] include_vars for defaults
Testing on 1.5.5 they appear at the level of "most everything else" - a variable defined in a include_vars file overrides an inventory variable. If they were at the level of facts, that would be great and would all default like behaviour and overriding by more environment specific data. On 29 April 2014 13:32, Michael DeHaan wrote: > include_vars creates fact scoped variables. > > Sorry, you're not going to be able to get it to work every which sort of > different way. > > I would not assume OS specific defaults *or* instead just put hosts in a > group based on the OS, if you really need that capability, and then could > use group_vars/ files to do this. > > > > > On Tue, Apr 29, 2014 at 3:05 AM, Matt Willsher wrote: > >> I'd like the included vars injected with the same precedence as those in >> defaults/main.yml rather than the precedence of vars/main.yml. The >> documentation is not clear on the what precendence include_vars get. >> >> From my testing, vars coming from include_vars have a higher precedence >> than inventory vars so they can not be overridden by inventory vars. >> >> Taking: >> >> 1. -e variables always win >> 2. then comes "most everything else" >> 3. then comes variables defined in inventory >> 4. then comes facts discovered about a system >> 5. then "role defaults", which are the most "defaulty" and lose in priority >> to everything. >> >> I'd like the included vars to have the precedence of 5, rather than 2 >> >> >> On 29 Apr 2014 00:55, "Michael DeHaan" wrote: >> >> > >> > I'm a little confused by this because you seem to be saying a feature >> isn't supported that is actually part of Ansible, but it's actually a >> module already in Ansible: >> > >> > http://docs.ansible.com/include_vars_module.html >> > >> > It also works with the "when" operator for per-OS variant usage. >> > >> > Were you perhaps reading an old thread talking about a language feature >> when it didn't exist? >> > >> > Sorry for confusion... >> > >> > >> > >> > >> > >> > >> > >> > On Mon, Apr 28, 2014 at 6:01 PM, Matt Willsher >> wrote: >> >> >> >> Hi, >> >> >> >> I'm trying to write generic roles for particular applications and keep >> hitting across the same problem: >> >> >> >> I want to set role default based on the operating system or other >> facts, like include_vars, but this doesn't appear to be supported. >> >> >> >> The only option I see practically available for template is to use the >> template logic to handle defaults, but that, while flexible, is not as >> elegant as being able to set by-fact defaults. >> >> >> >> The code I'm working at present on is >> https://github.com/WillsherPartners/ansible-sshd , where there is a >> large set of defaults and a template. sshd_subsystem_sftp varies depending >> on OS, but I still want to give the person using the role to option to >> override the value if they see fit. >> >> >> >> Are there any plans for include_vars: (include_defaults?) >> functionality in Ansible, or is there some other way to tackle per-os >> defaults? >> >> >> >> >> >> Thanks, >> >> Matt >> >> >> >> >> >> -- >> >> 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 post to this group, send email to ansible-project@googlegroups.com. >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/afaeac27-07cf-4e10-8504-ade22c361540%40googlegroups.com >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > >> > >> > -- >> > You received this message because you are subscribed to a topic in the >> Google Groups "Ansible Project" group. >> > To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/ansible-project/2VbVHrb0Xrc/unsubscribe >> . >> > To unsubscribe from this group and all its topics, send an email to >> ansible-project+unsubscr...@googlegroups.com. >> >>
Re: [ansible-project] include_vars for defaults
I'd like the included vars injected with the same precedence as those in defaults/main.yml rather than the precedence of vars/main.yml. The documentation is not clear on the what precendence include_vars get. >From my testing, vars coming from include_vars have a higher precedence than inventory vars so they can not be overridden by inventory vars. Taking: 1. -e variables always win 2. then comes "most everything else" 3. then comes variables defined in inventory 4. then comes facts discovered about a system 5. then "role defaults", which are the most "defaulty" and lose in priority to everything. I'd like the included vars to have the precedence of 5, rather than 2 On 29 Apr 2014 00:55, "Michael DeHaan" wrote: > > I'm a little confused by this because you seem to be saying a feature isn't supported that is actually part of Ansible, but it's actually a module already in Ansible: > > http://docs.ansible.com/include_vars_module.html > > It also works with the "when" operator for per-OS variant usage. > > Were you perhaps reading an old thread talking about a language feature when it didn't exist? > > Sorry for confusion... > > > > > > > > On Mon, Apr 28, 2014 at 6:01 PM, Matt Willsher wrote: >> >> Hi, >> >> I'm trying to write generic roles for particular applications and keep hitting across the same problem: >> >> I want to set role default based on the operating system or other facts, like include_vars, but this doesn't appear to be supported. >> >> The only option I see practically available for template is to use the template logic to handle defaults, but that, while flexible, is not as elegant as being able to set by-fact defaults. >> >> The code I'm working at present on is https://github.com/WillsherPartners/ansible-sshd , where there is a large set of defaults and a template. sshd_subsystem_sftp varies depending on OS, but I still want to give the person using the role to option to override the value if they see fit. >> >> Are there any plans for include_vars: (include_defaults?) functionality in Ansible, or is there some other way to tackle per-os defaults? >> >> >> Thanks, >> Matt >> >> >> -- >> 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 post to this group, send email to ansible-project@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/afaeac27-07cf-4e10-8504-ade22c361540%40googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/2VbVHrb0Xrc/unsubscribe. > To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscr...@googlegroups.com. > To post to this group, send email to ansible-project@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwr3ukLhnDdS9%3DZjM%3D1MPVte1D4H2RAbx_h%2BmkjJiDChg%40mail.gmail.com . > > For more options, visit https://groups.google.com/d/optout. -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKAnEVsDUvn0ttxxHeAFYTdiZS_7V21-yaHd%3DZRpeMhv_4by-A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] include_vars for defaults
Hi, I'm trying to write generic roles for particular applications and keep hitting across the same problem: I want to set role default based on the operating system or other facts, like include_vars, but this doesn't appear to be supported. The only option I see practically available for template is to use the template logic to handle defaults, but that, while flexible, is not as elegant as being able to set by-fact defaults. The code I'm working at present on is https://github.com/WillsherPartners/ansible-sshd , where there is a large set of defaults and a template. sshd_subsystem_sftp varies depending on OS, but I still want to give the person using the role to option to override the value if they see fit. Are there any plans for include_vars: (include_defaults?) functionality in Ansible, or is there some other way to tackle per-os defaults? Thanks, Matt -- 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 post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/afaeac27-07cf-4e10-8504-ade22c361540%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Nested includes don't inherit tags
I have a role such: tasks/main.yaml --- - include: part1.yaml tags=part1 - include: part2.yaml tags=part2 tasks/part1.yaml --- - name: "part1.1 This does stuff" file: ... tags: part1_1 - include: oft_used_taskset.yaml do=stuff tags=part1_2 What I was expecting is that tasks in oft_used_taskset.yaml would also be tagged with part1 from the very top level but this isn't happening - if I set skip tags to part1, the include tasks still get run. The work around is to use include: oft_used_taskset.yaml do=stuff tags=part1_2,part1 This looks like a bug at first pass, but I want to check before raising an issue over in GitHub. I'm used Ansible 1.4.4 Cheers, Matt -- 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 post to this group, send email to ansible-project@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.