Commit Graph

19 Commits (1573066ec1ec134a40f256a1d0bf5fe8634bee42)

Author SHA1 Message Date
Marcos Diez 366d52cf18 The documentation of lineinfile now makes reference to blockinfile (#3639) 2016-12-08 11:24:30 -05:00
Jose Moreira cc173b445e Fixed module doc typos 2016-12-08 11:24:06 -05:00
Tobias Wolf 1ecc8544f6 Add diff for both file contents and file attributes to lineinfile
Using the difflist feature added in ansible/ansible@c337293 we can add
two diffs to the `diff` dict returned as JSON: A `before` and `after` pair of
changed file contents and the diff of the file attributes.

n.b.: the difflist handling from the above commit is logically broken.
PR will follow.

Example output:

    TASK [change line and mode] ************************************************************
    changed: [localhost]
    --- before: /tmp/sshd_config (content)
    +++ after: /tmp/sshd_config (content)
    @@ -65,21 +65,21 @@
     X11DisplayOffset 10
     PrintMotd no
     PrintLastLog yes
     TCPKeepAlive yes
     #UseLogin no

     #MaxStartups 10:30:60
     #Banner /etc/issue.net

     # Allow client to pass locale environment variables
    -AcceptEnv LANG LC_*
    +AcceptEnv        LANG LC_* GF_ENV_*

     Subsystem sftp /usr/lib/openssh/sftp-server

     # Set this to 'yes' to enable PAM authentication, account processing,
     # and session processing. If this is enabled, PAM authentication will
     # be allowed through the ChallengeResponseAuthentication and
     # PasswordAuthentication.  Depending on your PAM configuration,
     # PAM authentication via ChallengeResponseAuthentication may bypass
     # the setting of "PermitRootLogin without-password".
     # If you just want the PAM account and session checks to run without

    --- before: /tmp/sshd_config (file attributes)
    +++ after: /tmp/sshd_config (file attributes)
    @@ -1,3 +1,3 @@
     {
    -    "mode": "0700"
    +    "mode": "0644"
     }
2016-12-08 11:24:02 -05:00
Jeff Widman 70b3290a3b Move validate command into doc fragment and fix a few typos 2016-12-08 11:23:24 -05:00
gimoh fd69c5687b Do not insert extra newline if line already contains it
When using YAML multi-line strings, e.g.:

- lineinfile:
    dest: /tmp/foo
    line: >
      foo
      bar

the line already ends with a newline.  If an extra newline is appended unconditionally it will lead to inserting an extra newline on each run.
2016-12-08 11:23:13 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
jaypei fbc8d4ca4a use the right way to unescape line string Reference https://github.com/ansible/ansible/issues/10864 2016-12-08 11:23:03 -05:00
Toshio Kuratomi 20d7f929be Fix use of codecs.escape_decode() 2016-12-08 11:22:59 -05:00
Toshio Kuratomi 5204e94bda Slightly more future-proof version of the lineinfile fix 2016-12-08 11:22:59 -05:00
Toshio Kuratomi 1002fafedf Correct lineinfile documentation about double quoting... Hasn't been the case for years. 2016-12-08 11:22:59 -05:00
Toshio Kuratomi 86f8a3d381 Clarify the documented behaviour of insertbefore slightly. 2016-12-08 11:22:46 -05:00
Piotr Gosławski 9dd4f22430 update docs for insertbefore/insertafter 2016-12-08 11:22:46 -05:00
Piotr Gosławski d388516046 Fix behavior when insert* doesn't match anything
If insertbefore/insertafter didn't match anything, lineinfile module was doing nothing, instead of adding the line at end of fille as it's supposed to.
2016-12-08 11:22:46 -05:00
Jeff Bradberry 60ed80f99a Fix breakage in lineinfile check mode when target file does not exist.
Similarly to https://github.com/ansible/ansible/issues/6182, checking of the file attributes should be avoided in check mode when the file didn't originally exist.

Also, avoid creating parent directories in check mode.

Fixes https://github.com/ansible/ansible/issues/9546
2016-12-08 11:22:33 -05:00
Eric 11bd0fed9d Fix lineinfile documentation typo 2016-12-08 11:22:28 -05:00
James Cammarata 429ab56e14 Adding file doc fragment to those modules in files/ missing it 2016-12-08 11:22:23 -05:00
Eric Hanchrow e4ac716663 Tweak docs to mention `replace` 2016-12-08 11:22:23 -05:00
Major Hayden e3449b6691 Updating SELinux example doc in lininefile module
Encouraging users to use this Ansible module to enable SELinux seems
like a better idea. It also warms Dan Walsh's heart.

Signed-off-by: Major Hayden <major@mhtx.net>
2016-12-08 11:22:23 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00