Skip to content

Commit

Permalink
Update demo repo
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdehaan committed Dec 9, 2018
1 parent 02ea41d commit be7fa23
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions content/inventory/inventory.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# * each entry is a hostname and a set of variables to apply to that host
# * one gotcha: in TOML, IPs need to be quoted

[groups.webservers.hosts]
example1234 = "opsmop_host=192.168.48.143"

[groups.group1.hosts]
hostname1 = "d=7 e=8 f=9"
"127.0.0.1" = "d=7 e=8 f=10"
Expand Down
17 changes: 15 additions & 2 deletions content/push_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,30 @@

inventory = TomlInventory("inventory/inventory.toml")

class BaseRole(Role):

def ssh_as(self):
# most users will want to omit this method and instead have a ~/.opsmop/defaults.toml
return ('mpdehaan', None)

def sudo(self):
return True

def sudo_as(self):
# if required, a password can be read from ~/.opsmop/defaults.toml
return ('root', None)

class WebServers(Role):

def push_to(self):
def inventory(self):
return inventory.filter('webservers*')

def set_variables(self):
return dict(what='bar', code=1234)

def set_resources(self):

return Resources(
Debug(),
Shell("uname -a")
)

Expand Down
15 changes: 15 additions & 0 deletions defaults.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# the first file found will be read in:
#
# ~/.opsmop/defaults.toml
# /etc/opsmop/defaults.toml
#
# these values can be overriden in policy files on a per-role basis.

[ssh]
default_username="opsmop"
# default_password="opsmop"

[sudo]
default_username="root"
# default_password=""

0 comments on commit be7fa23

Please sign in to comment.