Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.

Commit 98f0cd5

Browse files
committed
Mod: update readme
1 parent 4f68b71 commit 98f0cd5

File tree

1 file changed

+64
-18
lines changed

1 file changed

+64
-18
lines changed

README.md

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,66 @@ For detailed info about the logic and usage patterns of Example42 modules read R
2525
* Set a random password ( saved in /root/.my.cnf )
2626

2727
class { "mysql":
28-
root_password => 'auto',
28+
root_password => 'auto',
2929
}
3030

31-
* Create a new grant and database. mysql_db_init_query_file is optional and will run only once.
31+
* Create a new grant and database
32+
33+
### Create database and manage GRANT
34+
35+
The simplest way to create database is the following.
36+
37+
mysql::grant { 'db1':
38+
mysql_username => 'myusername',
39+
mysql_password => 'mypassword',
40+
}
41+
42+
This will create a MySQL database named 'db1' with a MySQL grant allowing full access to user 'myusername' with 'mypassword' password on local host.
43+
44+
#### Customize host source
45+
If you want to customize the host the new user can connect from you have to use the 'mysql\_host'.
46+
47+
mysql::grant { 'db1':
48+
mysql_username => 'myusername',
49+
mysql_password => 'mypassword',
50+
mysql_host => '10.42.42.0/255.255.255.0',
51+
}
52+
53+
Here the whole 10.42.42.0/24 can connect.
54+
55+
#### Customize privileges
56+
For privileges customization there is the 'mysql\_privileges' parameter.
3257

3358
mysql::grant { 'db1':
34-
mysql_privileges => 'ALL',
35-
mysql_password => 'pwd',
36-
mysql_db => 'db1',
37-
mysql_user => 'db1',
38-
mysql_host => 'host',
59+
mysql_username => 'myusername',
60+
mysql_password => 'mypassword',
61+
mysql_privileges => 'SELECT',
62+
}
63+
64+
The default grant privileges is 'ALL'.
65+
66+
#### Remove GRANT
67+
Like for standard puppet resource you can use the 'ensure' parameter in order to remove a grant.
68+
69+
mysql::grant { 'db1':
70+
ensure => 'absent',
71+
mysql_username => 'myusername',
72+
mysql_password => 'mypassword',
73+
}
74+
75+
This will ensure the 'myusername@localhost' grant is absent but not the database.
76+
77+
#### Load initial data
78+
The mysql\_db\_init\_query\_file is an optional parameter allowing to specify a sql file. The execution of this SQL file will be triger only once at the creation time.
79+
80+
mysql::grant { 'db1':
81+
ensure => 'absent',
82+
mysql_username => 'myusername',
83+
mysql_password => 'mypassword',
3984
mysql_db_init_query_file => '/full/path/to/the/schema.sql',
4085
}
4186

87+
__NOTE__: The SQL file should already be uploaded on mysql server host.
4288

4389
## USAGE - Basic management
4490

@@ -78,10 +124,10 @@ For detailed info about the logic and usage patterns of Example42 modules read R
78124

79125

80126
## USAGE - Overrides and Customizations
81-
* Use custom sources for main config file
127+
* Use custom sources for main config file
82128

83129
class { "mysql":
84-
source => [ "puppet:///modules/lab42/mysql/mysql.conf-${hostname}" , "puppet:///modules/lab42/mysql/mysql.conf" ],
130+
source => [ "puppet:///modules/lab42/mysql/mysql.conf-${hostname}" , "puppet:///modules/lab42/mysql/mysql.conf" ],
85131
}
86132

87133

@@ -92,17 +138,17 @@ For detailed info about the logic and usage patterns of Example42 modules read R
92138
source_dir_purge => false, # Set to true to purge any existing file not present in $source_dir
93139
}
94140

95-
* Use custom template for main config file
141+
* Use custom template for main config file
96142

97143
class { "mysql":
98-
template => "example42/mysql/mysql.conf.erb",
144+
template => "example42/mysql/mysql.conf.erb",
99145
}
100146

101147
* Define custom options that can be used in a custom template without the
102148
need to add parameters to the mysql class
103149

104150
class { "mysql":
105-
template => "example42/mysql/mysql.conf.erb",
151+
template => "example42/mysql/mysql.conf.erb",
106152
options => {
107153
'LogLevel' => 'INFO',
108154
'UsePAM' => 'yes',
@@ -116,20 +162,20 @@ For detailed info about the logic and usage patterns of Example42 modules read R
116162
}
117163

118164

119-
## USAGE - Example42 extensions management
165+
## USAGE - Example42 extensions management
120166
* Activate puppi (recommended, but disabled by default)
121167
Note that this option requires the usage of Example42 puppi module
122168

123-
class { "mysql":
169+
class { "mysql":
124170
puppi => true,
125171
}
126172

127173
* Activate puppi and use a custom puppi_helper template (to be provided separately with
128-
a puppi::helper define ) to customize the output of puppi commands
174+
a puppi::helper define ) to customize the output of puppi commands
129175

130176
class { "mysql":
131177
puppi => true,
132-
puppi_helper => "myhelper",
178+
puppi_helper => "myhelper",
133179
}
134180

135181
* Activate automatic monitoring (recommended, but disabled by default)
@@ -140,10 +186,10 @@ For detailed info about the logic and usage patterns of Example42 modules read R
140186
monitor_tool => [ "nagios" , "monit" , "munin" ],
141187
}
142188

143-
* Activate automatic firewalling
189+
* Activate automatic firewalling
144190
This option requires the usage of Example42 firewall and relevant firewall tools modules
145191

146-
class { "mysql":
192+
class { "mysql":
147193
firewall => true,
148194
firewall_tool => "iptables",
149195
firewall_src => "10.42.0.0/24",

0 commit comments

Comments
 (0)