mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use correct user to determine host files path, do not reuse .ansible
which is already taken for ansible management ops.
This commit is contained in:
parent
6307267cf3
commit
a5cb16c9d7
1 changed files with 4 additions and 2 deletions
|
@ -28,6 +28,7 @@ import random
|
||||||
import traceback
|
import traceback
|
||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import getpass
|
||||||
|
|
||||||
import ansible.constants as C
|
import ansible.constants as C
|
||||||
import ansible.connection
|
import ansible.connection
|
||||||
|
@ -405,8 +406,9 @@ class Runner(object):
|
||||||
def _save_setup_result_to_disk(self, conn, result):
|
def _save_setup_result_to_disk(self, conn, result):
|
||||||
''' cache results of calling setup '''
|
''' cache results of calling setup '''
|
||||||
|
|
||||||
dest = os.path.expanduser("~/.ansible/setup_data")
|
dest = os.path.expanduser("~/.ansible_setup_data")
|
||||||
if self.remote_user == 'root':
|
user = getpass.getuser()
|
||||||
|
if user == 'root':
|
||||||
dest = "/var/lib/ansible/setup_data"
|
dest = "/var/lib/ansible/setup_data"
|
||||||
if not os.path.exists(dest):
|
if not os.path.exists(dest):
|
||||||
os.makedirs(dest)
|
os.makedirs(dest)
|
||||||
|
|
Loading…
Reference in a new issue