LoginSignup
0
0

More than 5 years have passed since last update.

Ansibleのsysctlモジュールのabsentの挙動をみた

Last updated at Posted at 2018-03-12

CentOS7で増えてたっぽいdisableが名前に入ってるやつをAnsibleのsysctlモジュールでabsentにしたらどういう挙動なんかなと思ってやってみたところこんな感じだったという備忘録です。

まず初期状態の値は、net.ipv6.conf.all.disable_ipv6 = 0です。
これは値が1だとipv6無効化できるやつ。

# ansible localhost -c local -m sysctl -b -a "name=net.ipv6.conf.all.disable_ipv6 state=absent" 

localhost | SUCCESS => {
    "changed": false
}

absentって指定してみても"changed": falseでかわらない。つまりabsentは0にしてくれるやつみたいですね。

# sysctl -a |grep net.ipv6.conf.all.disable
net.ipv6.conf.all.disable_ipv6 = 0

次にvalueを指定してみるとちゃんとその値になっていました。

# ansible localhost -c local -m sysctl -b -a "name=net.ipv6.conf.all.disable_ipv6 state=present value=1" 

localhost | SUCCESS => {
    "changed": true
}
# sysctl -a |grep net.ipv6.conf.all.disable
net.ipv6.conf.all.disable_ipv6 = 1

結論的には値を指定しないとだめなやつでした。以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0