Justin___I have a question about pathing. I want to fork a repo, so I can override one of the templates it uses. I would like to be able to continue to rebase my repo to keep in sync with the master, so I would want to do this in a way that wouldnt cause issues.
Justin___The task looks like this.
Justin___- name: Configure bamboo server (server.xml) template: src: server.xml.j2
Justin___If I create a variable for 'server.xml.j2' and define it in group_vars/ .. would it look to a local files folder, or the one within the role's file folder?
SuperNinjaHi How do I find and register a file? Thanks
SuperNinjanm going to register FILE from module shell: ls -1 file_name and then get the {{ FILE.stdout }}
boxrickI have a super ugly blob of data which I have in STDOUT, can anyone think of a sensible way of getting this data into YML. Without some ugly shell hacking?
boxrickhttps://gist.github.com/boxrick/836abf20c0069d24b2a1c14f1650b4a2
boxrick A custom filter feels like the most sensible way
PalmarSup: newbie question. I want to create several users. I made a task, and then added several "user: " statements under that task. Ansible complains about "duplicate dict key". Am I understanding it correctly that I need to create a separate task for each user?
Palmar(Or, alternatively, define a yaml list of users, and call that as a variable)
JoelPalmar with_items
Palmaroh yaml does loops
Palmarnice
Palmarthanks
akofinko/ Hey folks. Is there an accepted practice for renaming an existing module? Like an alias or deprecated name?
agaffneyI don't think there's any mechanism to create a module alias, but you could mimic one by creating an action plugin with the old name that just calls the new module
akofinkokay, thanks for the help :)
leeyaahi guys
leeyaacan anyone give a suggestion why this works fine: https://bpaste.net/show/025b703d6f6a
leeyaabut when i try to add a wildcard like this https://bpaste.net/show/ddcb342a4b13 it no longer creates proper users
leeyaaspeaking of line 9 in second paste
leeyaasandbox_*.*:ALL doesnt work either
asydprivs is not an array
leeyaahm
asydultiple privileges can be specified by separating each one using a forward slash: `db.table:priv/db.table:priv'
leeyaaasyd: yeah but i dont want to specify multiple privs
leeyaai need a wildcard
leeyaae.g. sandbox_*
leeyaaone priv with wildcard
leeyaaif i use just sandbox_test.* it works fine
leeyaabut then it gives access to just this sandbox_test db, so i need a wildcard ;p
asydleeyaa: the mysql wildcard is % not *
leeyaaasyd: yes, thats what i am trying to use sandbox_%.*:ALL see https://bpaste.net/show/ddcb342a4b13
asydhttps://stackoverflow.com/questions/2668591/grant-with-database-name-wildcard-in-mysql
leeyaai tried that too before joining freenode as well
leeyaai understand the manual syntax
leeyaacant figure out how to do it with ansible
UnixMonkydoes adding backticks help? : "`sandbox_%`.*:ALL"
leeyaahm havent tried that
leeyaanah didnt work
UnixMonkyyou also may need to excape the underscore: "`sandbox\_%`.*:ALL"
leeyaai dont see it created in users table, but ansible reports no error
leeyaaweird
leeyaathis is what i see in ansible for one of the users: changed: [vm-sql2.bg.nc] => (item=({u'name': u'dcp', u'mysql': {u'privs': [u'`sandbox_%`.*:ALL', u'*.*:REPLICATION CLIENT']}}, u'192.178.10.77'))
UnixMonkyaah, I think i see. try specifying the yaml variable without the doublequote marks
CymewAnyone used the vmware_guest module to just power on and off virtual machines? According to the docs only things like name, state and password are needed, but when I try to run my playbook it asks for datastore, disk sizes and all kinds of irrelevant data. What am I doing wrong?
leeyaaUnixMonky: nope
leeyaai dont even see it in USER_PRIVILEGES table lol
do0mdo the vms have vmware tools Cymew ?
Cymewdo0m: Some. One of my goals with automating this environment is making sure all have it. Now it's hit and miss.
do0mi could be wrong, but i think you need to have vmware-tools properly set up on your hosts
do0mhave you tried running the playbook against a couple of hosts you know have them installed ?
CymewIs it needed even to do power management? I took one host that was powered off, tried to powered it on, in order to then run the task to make sure vmware-tools was installed.
Cymewdo0m: No, the docs gave no indication it was needed (unless I missed it) so I didn't think it would matter. I guess I should have covered all bases... Will have to try some other hosts.
UnixMonkyleeya: I'm not sure then. my feeling is that it's some mystical combination of backtick, doublequote and backslash-escape to make it do what you want.
UnixMonkyif you haven't already, try no quotes or backslash to see what happens, and hopefully you'll get a reasonable error if it fails.
Cymewdo0m: fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to find a matching datastore"} Seems to imply that made no difference.
leeyaaUnixMonky: i had a typo with one wrong ip (the host i was checking was configured with wrong ip)
leeyaalol from 30 hosts i was checking exactly the wrong one
leeyaawhat a luck
leeyaaas usual with such errors
leeyaahowever you were correct and - sandbox%.*:ALL worked
leeyaawithout quotes or \
do0mCymew: https://github.com/ansible/ansible/issues/30327 could this be it ? (in case you haven't seen it)
do0mat what task do you get the error anyway ?
CymewAt the task doing a state: poweron
leeyaaUnixMonky: thank you for the tips
CymewI had not seen that issue, and maybe the module referenced vmware_guest_powerstate might be worth looking at to begin with.
CymewI'm beginning to see why the vmware modules are classed as Preview. They does not feel that robust.
JoelPalmar yaml doesn't do loops, ansible does.
deanmanHello, I'm using a pip module to install and upgrade pip itself and another tool. For some reason it's not idempotent and will always indicate there has been a change. Any hints what might be wrong ?
loekendeanman, what os is on the target?
survietaminedeanman: isn't this ok? http://docs.ansible.com/ansible/latest/playbooks_error_handling.html#overriding-the-changed-result
deanmanloeken, centos7
deanmanloeken, wipe that, ubuntu 16.04
loekendid you try manually running the pip upgrade pip?
loekeniirc i had a similar problem that normal pip didnt upgrade on 16.04 or 14.04
deanmanloeken, actually I have a vagrant project and use vagrant's ansible provisioner. When provisioning with vagrant then it has the right behavior, if i do it using ansible-playbook i get the error
stefano-but-not-deanman: what line are you using in your playbook?
deanmanstefano-but-not-, what do you mean by line ?
deanmanhttp://paste.ubuntu.com/26089729/
stefano-but-not-deanman: and which ansible version are you running?
CymewHmm. Can't find the powerstate module.
deanmanhmm ok, when manually executing the same command i get a yellow text output which it advises me to use -H
stefano-but-not-deanman: this was an issue in the past, but it was solved, as far as I know.
deanmanstefano-but-not-, 2.4.1.0
iintheskyWow-- I ran into the most bizarre behavior last night with SSH -- can't figure out what the heck is going on
CymewOh first in 2.5
CymewLooks like I need to head to the vmware channel for ansible. Thanks for the debugging help do0m!
gumpin the ansible documentation, i always see playbooks in the base directory. in particularly large organizations, that starts to become unmanageable. is there another best practices model i can use with a nested hierarchy of playbook directories?
gumpie. playbooks per business unit, subdivided into different task groups
KBmethere are roles
KBmethat's what I use
gumpright, i get that, but roles are still called by playbooks in the base directory
gumpand if you move the playbooks into subdirectories, the import hierarchy for roles and group vars no longer works as expected
KBmewell, I just have host groups and define roles for the groups, so my playbook is not very long, it's all in the roles)
gumpi assume you don't work for an organization with 20 different devops teams :/
bcocathey work as expected, they just dont work as you want them to
KBmeah, you may want some dynamic inventory no?
gumpi am already using dynamic inventory
gumpthe problem is that i have 200+ playbooks in a single directory. it's not user friendly
bcocadont disagree, but you can make relative refs
gumptrue. bit hacky though. i was hoping there was an established model for this
gumpalright, thanks
finisherrSo, if I have one of these variables (http://docs.ansible.com/ansible/latest/intro_inventory.html#list-of-behavioral-inventory-parameters) set in more than one group to which a host belongs, how does the variable resolve?
agaffneyfinisherr: the precedence is not well defined between vars defined at the same level like that, and you should generally try to avoid that situation
flowerysongagaffney: It's well defined. https://docs.ansible.com/ansible/devel/intro_inventory.html#how-variables-are-merged
finisherrI think this is what I was looking for: https://github.com/ansible/ansible/blob/devel/lib/ansible/vars/manager.py#L76
agaffneyflowerysong: ah, I don't think that was documented in earlier versions, and there's a new option in 2.4 to control it
agaffneyit still just seems "better" to avoid the situation altogether
needlehowdy. Is there a way to make a condition comparing a stdout and a variable ?
needlesomething like https://pastebin.com/tahVThYf
needleI have tried to replace the when: "not '154-2.SE2.bin' in bootvar.stdout[0]" with when: "not 'firmware1' in bootvar.stdout[0]". firmware1 is a variable, but it does not match
agaffneyneedle: drop the [0] or use stdout_lines instead
agaffneystdout[0] grabs just the first char of stdout
agaffneyand drop the quotes around firmware1 if it's a var
needleagaffney: I removed the '' and dropped the {
needleagaffney: I removed the '' and dropped the [0] also added stdout_lines
cashlesscactusI am trying to use the git module to clone a project using ssh, I've added my ssh keys to bitbucket and im still getting permission errors... anyone experienced this and could point me in the right direction?
needleStill does not match, it has then state "changed" but should "skip" if working correctly
agaffneyneedle: you either want bootvar.stdout or bootvar.stdout_lines[0], unless the string you are looking for is an exact match for one of the lines of stdout
agaffneyand bootvar.stdout_lines[0] would look at only the first line of stdout
agaffneycashlesscactus: are your SSH private keys present on the remote host where the 'git' module is being used? if not, you'll need to setup SSH agent forwarding from the machine where you run ansible (which presumably does have the SSH private keys)
needleagaffney: the bootvar is only 1 line, so it does not matter if stdout or stdout_lines i set bootvar.stdout. I check the debug of that skript
needlemaybe I find something what is going wrong
agaffney'when: firmware1 in bootvar.stdout_lines.0' is probably what you want
agaffneybut I can only guess without seeing the output of '- debug: var=bootvar' and '- debug: var=firmware1'
needlehttps://pastebin.com/sueCy1DA this is how it is stripped down
cashlesscactusagaffney: I believe so. I'm kind of new to ansible but I have 2 VMs, one is the ansible host, the other is what im trying to clone my nodejs project on... My playbook is able to install nodejs, but when it gets to cloning the project, thats where it fails... I'm not sure i understand 'ssh forwarding' could you explain that?
needleThis does not work "when: not firmware1 in bootvar.stdout_lines" when firmware1=c2960-bla.bin
agaffneyneedle: as I said, that will only work if the 'stdout_lines' array has an element that *exactly* matches 'c2960-bla.bin'
cashlesscactushmm hang on, I just tried to manually clone the project and it didnt let me... Maybe I didnt add my ssh keys correctly
agaffneyalso, you should probably do 'not (firmware1 in bootvar.stdout_lines.0)' to avoid the 'not' applying just to the 'firmware1' var instead of the statement
cashlesscactusls
needleyou are right, I need the exact match agaffney
needlethanks for the hint agaffney
boxrickThere is an INI file lookup, is there a YAML or JSON style lookup?
bcocafile
boxrickfrom_vars happens too late in the process so is no good.
boxrickok
bcoca^ file lookup will read yaml/json
boxrickOk lovely, cheers :)
bcocainclude_vars is better though
boxrickI imagine, but in this case it needs to live in group_vars file
agaffneyboxrick: you can stick the YAML/JSON directly in group_vars file, perhaps under a key to give it a single var name to reference
boxrickI have a role which sucks up a whole bunch of gross data from an IPMI interface and formats it into some YML and dumps it out in a /tmp location.
boxrickI guess I could dump it directly into the group_vars folder somehow.
agaffneythen you probably just want to use something like {{ lookup('file', '/tmp/foo') | from_yaml }}
iintheskyDoes anyone know if ansible chroot works remotely?
agaffneyiinthesky: it doesn't...you can't combine multiple connection plugins
agaffneyhowever, there are some terrible hacks that will make it work
boxrickagaffney can you think of an easy way to access a subset of that yml data?
iinthesky:( I was saying earlier .. i figured it doesn't work so i was hacking around cobbler's trigger mechanisms to run ansible post build
boxrickIn this case I need that var to be a specific bit of that mass of data ( its a dict of dicts inside the file )
agaffneyboxrick: {{ (lookup('file', '/tmp/foo') | from_yaml).foo.bar }}
iintheskyits doable but i ran into the weirdest thing ever
boxrickOh ok
boxrickThats pretty easy
boxrickcheers ^_^
iintheskycan't figurei t out
agaffneyiinthesky: https://github.com/agaffney/ansible-gentoo_install/blob/master/tasks/chroot.yml <-- this gives you an idea of how to make SSH+chroot work. at that time I wrote that, that method would break modules like 'copy', but there's now the 'ansible_ssh_transfer_method: piped' option, which will work with the chroot hack
agaffneyhttps://github.com/agaffney/ansible-gentoo_install/blob/master/files/chroot_wrapper.sh <-- the chroot wrapper script
iintheskyI saw this i think.. or something liek it.. ssh actually has a ChrootDirectory directive you can put into sshd config
iintheskyit works great
finisherrDoes anyone happen to know what sources is here? https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/manager.py#L121
iintheskybut.. for some reason, when i connect to this box as root, something is refusing me access to write to / -- totally insane
iintheskyi can write to every other filesystem/mount .. but not /
iintheskyperm denied
iintheskybizarre as hell
iintheskymust be some buggy behavior i dunno what else to think
needlegot it working with this when: "not firmware1 in bootvar.stdout[0]"
needleif I set when: "not firmware1 in bootvar.stdout_lines" it does not match
needleyou said something about "not ( firmware1 in bootvar.stdout[0])"
needleneed to try that out
StefKavHi all
needleOK this works: when: "not (firmware1 in bootvar.stdout[0])"
needlethanks once again for the hints agaffney
StefKavWondering if anyone can help with a query re the assert module? I'm using assert with a 'with_items' and getting loads of output as a result - is there a way to quieten it down?
finisherrAhh, maybe sources is a list of the found hosts. Looking at this as a reference: https://github.com/ansible/ansible/blob/932f62ab576e920ba17020e5340681131fbe85d2/docs/docsite/rst/dev_guide/developing_api.rst#python-api-20
StefKavI've tried using 'no_log' which is better but wondering if there's a better/preferred way?
boxrickIs there any way to make a file lookup fail gracefully ?
boxrickWith a default or blank value of some description
boxrickI have had this problem with lookups before
finisherrAh, more likely an inventory file than host list
finisherrfor sources
Enphuegoanyone know how to make win_package fail in the middle so that I can see the command it's trying to run?
alexs__Hey all. Question about Action Plugins. In a normal module, I can use module.fail_json(). Is something similair available from within an action plugin? Note, I don't have a module at all, just the action plugin and an empty module file.
bcocaalexs__: just return a dict
bcoca'skipped', 'fai;ed
bcoca^ as fields of the dict
[diablo]Good evening #ansible ... guys could anyone tell me the correct syntax to use the registered variable in 'name' for the copy please? https://paste.fedoraproject.org/paste/CBCd642gfTfSojTHHBEUhw
[diablo]obviously currently it's writing the string of name
alexs__bcoca I knew it'd be that simple, thank you !
bcocafile: '{{sm.config}}'
bcocaassuming sm is your registered var?
[diablo]hi bcoca it's the name on that is the registered variable, like sm_repo
EnphuegoI'd maybe change the format of that... use copy module with delegate_to: localhost and then put the copy parameters on their own line
[diablo]I need to write the contents of it's stdout to the file named redhat.repo
[diablo]hi Enphuego
[diablo]Enphuego is local_action not the same?
Enphuegoit is the same, just when the behavior is odd I like to put it in the simplest, clearest format so that I can figure out where things are going wrong
[diablo]ah ok gotcha'
[diablo]would you know how I can access the variable please?
EnphuegoI have a suspicion that changing the format may unexpectedly fix your problem
EnphuegoThe content ends up being "name" correct?
[diablo]well, the value of name, yes
[diablo]so I get a file say, /tmp/redhat.repo within it is the string "sm_repo"
Enphuegothat's what you asked it to do
[diablo]yes
alexs__But the value of item.name IS sm_config - do you want to interpret / eval that string as a var ?
[diablo]as I don't know how to address it correctly I'm afraid
Enphuego copy content="{{ item.name }}\n"
Enphuegoso you want the content of that file?
[diablo]yes, the var sm_repo is registered with a cat of /etc/yum.repos.d/redhat.repo
Enphuego copy src="{{ item.name }}"
Enphuegouse src instead of content
[diablo]oh really
[diablo]ACTION hits docs
Enphuegocontent takes the direct value of that string and puts it in the file
Enphuegoansible training ftw
codelinxcan someone take a look at this and see possible why it may be failing … https://paste.drhack.net/?a2678b02b5f6f151#i2+xHrW8UQOYK9ICTMr+ThUXQtvbLptEdjYAAC0dxKI=
codelinxpossibly*
[diablo]Enphuego I see src it's a path to file...
Enphuegoif you use copy with the src paramater it copies one file to another
Enphuegoif you use copy with the content parameter is copies a string into a file
[diablo]yes but this the src is not a file, it's a registerd vars content
agaffneycodelinx: refusing to convert between directory and link for /opt/atlassian/jira/current <-- you're trying to replace a directory with a symlink. if you actually mean to do this, you can probably add force=yes
Enphuegoah I see, give me a sec to think about that
[diablo]Enphuego I wrote further up exactly which is the vars name, content and the file it's to go to
codelinxno i want to create the linke “/opt/atlassian/jira/current” from "/opt/atlassian/jira/jira-xxx-xxx-xxx”
codelinxso /opt/atlassian/jira/current -> /opt/atlassian/jira/jira-xxx-xxx-xxx
[diablo]local_action: copy content="{{ sm_repo }}\n" dest="/tmp/redhat.repo"
[diablo]basically as it if was doing that
[diablo]local_action: copy content="{{ sm_repo['stdout'] }}\n" dest="/tmp/redhat.repo"
[diablo]more so like that actually I need to do
Enphuegocopy src="{{ item.file }}\n" dest="/tmp/redhat.repo"
[diablo]no no
[diablo]:)
Enphuegowait lol
[diablo]item.name is the name of a registered variable
Enphuegogotcha
[diablo]https://paste.fedoraproject.org/paste/t-7jSpXgbNq7JhZOkx2CXA
[diablo]better the full pb :)
[diablo]my bad
[diablo]ingore the 1st copy , it's left over from a test...
Enphuegocan you even do that? reference a variable by the variable name?
Enphuegoat runtime
[diablo]no idea
[diablo]that's why I'm here :)
EnphuegoI have no idea if this works but have you tried {{ {{ {{ item.name }} }}
codelinxagaffney: should i change the options?
[diablo]wow ok :)
[diablo]let me try
agaffneycodelinx: are you sure that /opt/atlassian/jira/current doesn't already exist on the remote host?
codelinxi deleted it ….
Enphuegosorry should be {{ {{ item.name }} }}
codelinxubuntu@ip-10-xx-xx-xx:/opt/atlassian/jira$ ls -l
[diablo]giving it a whirl
codelinxtotal 4
codelinxdrwxr-xr-x 13 jira jira 4096 Nov 16 09:36 atlassian-jira-software-7.6.0-standalone
codelinxthat is what i have
[diablo]subscription-manager is slow to repsond
[diablo]{"failed": true, "msg": "template error while templating string: expected token ':', got '}'. String: {{ {{ item.name }} }}\n"}
[diablo] local_action: copy content="{{ {{ item.name }} }}\n" dest="/tmp/{{ item.file }}"
[diablo]that was with the upper line
[diablo]I guess I'd have to nest the loop... lookup the vars contents, register it as another var, and use that as my content
flowerysongDon't nest moustaches ({{ }}).
EnphuegoI don't really think you can do that...
[diablo]hmmmm
[diablo]shame
Enphuegowell I'm no expert
[diablo]I think perhaps I could do a nested one tho
[diablo]but I'm no expert as you can already see :)
flowerysongIf you want to reference a variable based on another variable, it would be {{ vars[item.name] }}
Enphuegowell there we go a real expert
[diablo]flowerysong hey.. .so I can do it?
[diablo] local_action: copy content="{{ {{ vars[item.name] }} }}\n" dest="/tmp/{{ item.file }}"
[diablo]I will try it
flowerysongJust {{ vars[item.name] }}, not {{ {{ vars[item.name] }} }}
[diablo]without the extra braces
[diablo]sorry, used up arrow to write pervious one
[diablo]running it now
[diablo]flowerysong dude, thank you so much, and actually quite a logical syntax really
boxrickI need to append a string to a variable in a when condition, sadly the formatting really isn't consistent with the rest of the Ansible world. Any thoughts on how I can achieve this?
agaffneycodelinx: it looks like your arguments are correct. that error you get just means that there's already a directory at /opt/atlassian/jira/current when that task runs
boxrickwhen: VAR1 + '.yml' not in VAR2
agaffneyboxrick: what have you tried?
boxrickSorry nothing yet due to where it is sat
boxrickI just don't know the correct formatting
boxrickBut you should hopefully get the gist of what I need from the above
boxrickI imagine its a weird combination of quoting and double quoting
agaffneywhen: (VAR1 + '.yml') not in VAR2
boxrickCheers
bschlueter'd like to include an Ansible role developed by somebody else -- in their own git-repository -- into our project (by way of a GitHub-fork of our own).from https://stackoverflow.com/questions/47599119/why-use-ansible-galaxy-over-git-subtree
bschlueterI can do that with ansible-galaxy or with git subtree.
[diablo]guys many many thanks as per usual ... back monday , have a good weekend
bschluetersorry, let me rephrase, copy-paste is annoying
bschlueterI'd like to include an Ansible role developed by somebody else -- in their own git-repository -- into our project (by way of a GitHub-fork of our own). I can do that with ansible-galaxy or with git subtree. Why would one method be preferable over the other (or any other method)? from https://stackoverflow.com/questions/47599119/why-use-ansible-galaxy-over-git-subtree
finisherrHow can I construct an InventoryManager if the source is the output returned from a dynamic inventory script?
agaffneybschlueter: it comes down to your needs. the git subtree/submodule method is useful if you will do any development against those other roles. otherwise, you can just "vendor" the roles (copy them to your own git repo)
agaffneyit doesn't make much difference to ansible
agaffneyfinisherr: I haven't poked much around in that part of the code, but I'd think that the input would be a *path* to the script to run to generate the JSON
finisherrYeah, i suppose it’s worth a shot
agaffneythe input to any inventory plugin will be something that would be passed to the -i option of the ansible commands
finisherrYep
bschlueterthanks agaffney. That question is being publicly asked by my coworker because I've added a few roles as ansible-galaxy dependencies to our core ansible repo with contains > 50 roles. I've gotten tired of dealing with pull requests which may fix our infrastructure, but break some other part of it because they change how the role behaves, and when we vendor we make updating the roles from upstream more
bschlueterdifficult.
agaffneywelcome to the world of opensource tools :)
agaffneyyou have to find your own balance that meets your needs
EverspaceI've personally just installed them to a seperate roles folder and keep them beside my own roles.
Everspaceand commit them. I don't want to have to deal with pulling all the time and that sort of thing.
jwitko_when listing conditionals as a YAML " - " list item
jwitko_is that considered an OR or an AND ?
flowerysongAnd.
jwitko_ty
EnphuegoI really really need to see what the win_package module is trying to run - anyone know were I can see that info on the windows target?
bschlueter agaffney: that's the problem, we my coworker and I disagree on what that balance is. I made it easy though as both methods currently work in our system, jenkins jobs just have to have an ansible-galaxy call before playbook runs.
Enphuegois there a scratch file where ansible puts the winrm commands for windows?
agaffneyprobably not, but I'm not familiar with the windows modules
EnphuegoIt's so frustrating - I can't troubleshoot this because it doesn't give me anything useful in the log when it fails
Enphuegoah thank god figured it out - if I kill the Windows installer task it fails in a way that logs what was run
Enphuegothe log for win_package is apparently in C:\\Users\\username\\AppData\\Local\\Temp\\
Enphuegocan't for the life of me figure out why Windows hates this command
Enphuegohttps://www.irccloud.com/pastebin/tShT6Ds3/
agaffneyEnphuego: try using \\ as your shell may be interpreting those as escape sequences before it makes it to ansible
Enphuegostill doesn't work, same exact error
agaffneytry even more backslashes
agaffneyI'm only half joking
zoredachemaybe try / characters instead? Powershell will permit that for paths
agaffneyyes, or that :)
agaffneyfar less likely to get messed up along the way
Enphuegoforward slashes worked
zoredacheIs there a way for me to tell ansible to kill off all the SSH ControlMaster sockets/sessions it created during a play? During one play during my initial setup I am creating the account I will normally use for ansible_user. Then during the next run I want to delete the default account that was included in a OS image. But ansible won't let me remove that account since it is still in use. But the only thing open is that ssh
zoredachesession used during the intial setup.
agaffneyzoredache: '- meta: reset_connection' should do it
agaffneyas of 2.3
zoredacheAh, that looks promising. Thanks.
ururuwhat does one do when copy fails on stat? Failed to get information on remote file
bcocafind cause
bcocaprobably permission error
ururu@bcoca how does one debug such issue? seems like locally I can create and stat file ok.
bcoca-vvvv
ururu<172.16.0.168> EXEC /bin/sh -c 'sudo -H -S -p "[sudo via ansible, key=gnrgnntqsruokbnwrwvrveywsszaavbz] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-gnrgnntqsruokbnwrwvrveywsszaavbz; /usr/bin/python /tmp/ansible-tmp-1512166354.38-70609317115440/stat.py'"'"' && sleep 0' fatal: [172.16.0.168]: FAILED!
ururuthen I get the stat failed line
maldridgeon a hunch do you have python on the remote host?
ururuyes, python is installed
ururuand is in the expected place (/usr/bin/python)
Led_Zeppelinwhat is the easier way to check if I am able to ping a single ansinble host. want to see if ssh connection is working properly.
miscansible -m ping -l thehost all
agaffneyansible your_host -m ping
Led_Zeppelinhmm. i keep getting getcwd cannot access parent directories sheel--init
Led_ZeppelinBTW, ssh userA@foo "uptime" works perfectly fine .
Led_Zeppelinso, when I do ansible -m ping -l host -u userA i keep getting Missing target hosts?
agaffneyjust drop the -l. it complicates things for what you are doing
Led_Zeppelinhmm. ansible -m ping hostname -u userA seems like it ran.
Led_Zeppelinbut not sure if it actually did anything because status code is 0
Led_Zeppelinbut even for a non existence host it works :p
robindo I need to setup something for ansible multiplexing or does it work by default?
bcocadepends on what you mean
robinbcoca: for two or more hosts to be run on the same time
bcocahosts: 2ormorehosts
bcocadefault forking is 5
bcoca--forks # to increase/decrease
bcocait will run tasks on all hosts but only # forks in paralell same time until all hsots done, then next task (unless using serial, but you should read docs for that)
bcocarobin: not really 'multiplexing' as parallelising
robinbcoca: thanks! What about ssh through a bastion host? Do I need to setup multiplexing there, sorry I didn't explain well enough
bcocamultiplexing has nothing to do with bastion hosts, just add it to ssh_args to point to the proxy, several examples online
robinbcoca: ok, my understanding is limited, sorry :). Thanks alot.
bcocamultiplexing is reusing the same connection for multiple actions/channels
bcocawhich you CAN do witha bastion by creating a single shared connection to it, but that is not needed to use a bastion
bcocanormally used with ssh directly against same machine, using local pipe to avoid reconnecting
bcocabut with bastion/jump host you dont actually want that if targeting multiple hosts
bcocayou might want to multiplex per each host, but not per bastion
bcocassh should do that automatically if new enough on all hosts
robinbcoca: so the connection to the bastion host is being reused to connect to the other hosts?