Search code examples
shellcolor-schemegnome-terminalansible

Can not change gnome-terminal to solarized by running script with ansible playbook


I'm writing some roles for setting up a virtual machine using ansible.

I'm trying to set the gnome-terminal color theme to Solarized https://github.com/Anthony25/gnome-terminal-colors-solarized

I can run the script from the terminal and the color changes immediately

$ ~/solarized/gnome-terminal-colors-solarized/install.sh -s dark -p Default

But when I run it from ansible:

  - name: Set Solarized color to Default profile
    script: /home/someuser/solarized/gnome-terminal-colors-solarized/install.sh -s dark -p Default

The result look ok

TASK: [solarized | Set Solarized color to Default profile] *********************** 
changed: [localhost]

But nothing changed! I check the config file at ~/.gconf/apps/gnome-terminal/profiles/Default/ and it did not change as well

I tried shell, command but still the same result.

I tried run

install.sh -s lkefjefj -p lefjelkfj 

and it throws errors, so it actually reads the arguments

The script is run with sudo option.

So I do not understand why it is not working?


Solution

  • I found the problem. The script is run in ansible as root user when I declare "sudo: yes" in the main playbook. when I supplied "sudo_user: my_user" it run correctly