Skip to content

Instantly share code, notes, and snippets.

@lucastorri
Created June 26, 2013 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucastorri/5866153 to your computer and use it in GitHub Desktop.
Save lucastorri/5866153 to your computer and use it in GitHub Desktop.
file_client: local
mysql.default_file: '/etc/mysql/debian.cnf'
include:
- salt.modules.mysql
mysql-client-5.5:
pkg.installed
mysql-server-5.5:
pkg.installed
python-mysqldb:
pkg.installed
mysql-service:
service.running:
- name: mysql
- require:
- pkg: mysql-server-5.5
mysql-base:
mysql_database.present:
- name: pcur
- require:
- service.running: mysql
mysql_user.present:
- name: pcur
- password: pcur
- require:
- service.running: mysql
mysql_grants.present:
- database: pcur.*
- grant: ALL PRIVILEGES
- user: pcur
- require:
- service.running: mysql
- mysql_database.present: pcur
- mysql_user.present: pcur
require:
- pkg: python-mysqldb
$ sudo salt-call state.highstate
[INFO ] Configuration file path: /etc/salt/minion
[INFO ] Executing command 'ps -efH' in directory '/home/vagrant'
[INFO ] Loading fresh modules for state activity
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/modules'
[INFO ] Syncing modules for environment 'base'
[INFO ] Loading cache from salt://_modules, for base)
[INFO ] Caching directory '_modules/' for environment 'base'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/states'
[INFO ] Syncing states for environment 'base'
[INFO ] Loading cache from salt://_states, for base)
[INFO ] Caching directory '_states/' for environment 'base'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/grains'
[INFO ] Syncing grains for environment 'base'
[INFO ] Loading cache from salt://_grains, for base)
[INFO ] Caching directory '_grains/' for environment 'base'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/renderers'
[INFO ] Syncing renderers for environment 'base'
[INFO ] Loading cache from salt://_renderers, for base)
[INFO ] Caching directory '_renderers/' for environment 'base'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/returners'
[INFO ] Syncing returners for environment 'base'
[INFO ] Loading cache from salt://_returners, for base)
[INFO ] Caching directory '_returners/' for environment 'base'
[INFO ] Creating module dir '/var/cache/salt/minion/extmods/outputters'
[INFO ] Syncing outputters for environment 'base'
[INFO ] Loading cache from salt://_outputters, for base)
[INFO ] Caching directory '_outputters/' for environment 'base'
[INFO ] Loading fresh modules for state activity
[ERROR ] Unknown include: Specified SLS base: salt.modules.mysql is not available on the salt master in environment(s): base
[INFO ] Executing state pkg.installed for mysql-server-5.5
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Executing command 'apt-get -q update' in directory '/home/vagrant'
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Executing command 'apt-get -q -y -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-confdef install mysql-server-5.5' in directory '/home/vagrant'
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Installed Packages:
mysql-client changed from absent to 1
libmysqlclient18 changed from absent to 5.5.31-0ubuntu0.12.04.2
virtual-mysql-client changed from absent to 1
mysql-client-4.1 changed from absent to 1
virtual-mysql-server changed from absent to 1
mysql-client-core-5.5 changed from absent to 5.5.31-0ubuntu0.12.04.2
mysql-server-core changed from absent to 1
mysql-server-5.5 changed from absent to 5.5.31-0ubuntu0.12.04.2
mysql-common changed from absent to 5.5.31-0ubuntu0.12.04.2
mysql-server-core-5.5 changed from absent to 5.5.31-0ubuntu0.12.04.2
mysql-client-5.5 changed from absent to 5.5.31-0ubuntu0.12.04.2
mysql-common-4.1 changed from absent to 1
libdbd-mysql-perl changed from absent to 4.020-1build2
[INFO ] Loading fresh modules for state activity
[INFO ] Executing state service.running for mysql
[INFO ] Executing command 'service mysql status' in directory '/home/vagrant'
[INFO ] No changes made for mysql
[ERROR ] No changes made for pcur
[ERROR ] No changes made for pcur
[INFO ] Executing state pkg.installed for mysql-client-5.5
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] No changes made for mysql-client-5.5
[INFO ] Executing state pkg.installed for python-mysqldb
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Executing command 'apt-get -q -y -o DPkg::Options::=--force-confold -o DPkg::Options::=--force-confdef install python-mysqldb' in directory '/home/vagrant'
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] Installed Packages:
python2.7-mysqldb changed from absent to 1
python-mysqldb changed from absent to 1.2.3-1ubuntu0.1
[INFO ] Loading fresh modules for state activity
[INFO ] Executing state pkg.installed for vim
[INFO ] Executing command "dpkg-query --showformat='${Status} ${Package} ${Version}\n' -W" in directory '/home/vagrant'
[INFO ] Executing command 'grep-available -F Provides -s Package,Provides -e "^.+$"' in directory '/home/vagrant'
[INFO ] No changes made for vim
local:
----------
State: - pkg
Name: mysql-server-5.5
Function: installed
Result: True
Comment: The following packages were installed/updated: mysql-server-5.5.
Changes: mysql-client: { new : 1
old :
}
libmysqlclient18: { new : 5.5.31-0ubuntu0.12.04.2
old :
}
virtual-mysql-client: { new : 1
old :
}
mysql-client-4.1: { new : 1
old :
}
virtual-mysql-server: { new : 1
old :
}
mysql-client-core-5.5: { new : 5.5.31-0ubuntu0.12.04.2
old :
}
mysql-server-core: { new : 1
old :
}
mysql-server-5.5: { new : 5.5.31-0ubuntu0.12.04.2
old :
}
mysql-common: { new : 5.5.31-0ubuntu0.12.04.2
old :
}
mysql-server-core-5.5: { new : 5.5.31-0ubuntu0.12.04.2
old :
}
mysql-client-5.5: { new : 5.5.31-0ubuntu0.12.04.2
old :
}
mysql-common-4.1: { new : 1
old :
}
libdbd-mysql-perl: { new : 4.020-1build2
old :
}
----------
State: - service
Name: mysql
Function: running
Result: True
Comment: The service mysql is already running
Changes:
----------
State: - mysql_database
Name: pcur
Function: present
Result: False
Comment: State mysql_database.present found in sls mysql is unavailable
Changes:
----------
State: - mysql_user
Name: pcur
Function: present
Result: False
Comment: State mysql_user.present found in sls mysql is unavailable
Changes:
----------
State: - mysql_grants
Name: mysql-base
Function: present
Result: False
Comment: One or more requisite failed
Changes:
----------
State: - pkg
Name: mysql-client-5.5
Function: installed
Result: True
Comment: Package mysql-client-5.5 is already installed
Changes:
----------
State: - pkg
Name: python-mysqldb
Function: installed
Result: True
Comment: The following packages were installed/updated: python-mysqldb.
Changes: python2.7-mysqldb: { new : 1
old :
}
python-mysqldb: { new : 1.2.3-1ubuntu0.1
old :
}
----------
State: - pkg
Name: vim
Function: installed
Result: True
Comment: Package vim is already installed
Changes:
base:
'*':
- vim
- mysql
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.synced_folder "salt/", "/srv/"
config.vm.provision :salt do |salt|
salt.minion_config = "salt/minion.conf"
salt.run_highstate = true
end
end
@eon01
Copy link

eon01 commented May 19, 2015

Hi @lucastorri.
I am trying to install Mysql (using a masterless Salt in a vagrant machine), configure it (add new user, grant, ..etc).
I had almost the same problems as you had. Have you fixed this ? If yes, could you please provide me with some explanations ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment